On Thursday 12 May 2016 15:29:15 Cédric Bosdonnat wrote:
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml index 7e9f735..a878a3e 100644 --- a/v2v/windows_virtio.ml +++ b/v2v/windows_virtio.ml @@ -66,11 +66,19 @@ let rec install_drivers g inspect systemroot root current_cs rcaps = else ( (* Can we install the block driver? *) let block : guestcaps_block_type = - let has_viostor = g#exists (driverdir // "viostor.inf") in + let filenames = ["virtio_blk"; "vrtioblk"; "viostor"] in + let driver_name = try ( + List.find ( + fun driver_file -> + let source = driverdir // (driver_file ^ ".sys") in + g#exists source + ) filenames + ) with Not_found -> "" in + let has_viostor = not (driver_name = "") in
Instead of using an empty string for driver_name, use an OCaml option: let driver_name = try ( Some ( List.find ( ... ) ) ) with Not_found -> None in let has_viostor = is_some driver_name in It is slightly longer, but IMHO clearer to read. -- Pino Toscano