mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
mllib: move is_regular_file there
Move the is_regular_file function, implemented in virt-dib and virt-v2v, to Common_utils.
This commit is contained in:
@@ -147,9 +147,6 @@ let copy_element element destdir blacklist =
|
||||
let dirs, nondirs = List.partition is_directory entries in
|
||||
let dirs = List.map (fun x -> (x, element.directory // x, destdir // x)) dirs in
|
||||
let nondirs = List.map (fun x -> element.directory // x) nondirs in
|
||||
let is_regular_file file =
|
||||
try (Unix.stat file).Unix.st_kind = Unix.S_REG
|
||||
with Unix.Unix_error _ -> false in
|
||||
List.iter (
|
||||
fun (e, path, destpath) ->
|
||||
do_mkdir destpath;
|
||||
|
||||
@@ -806,3 +806,7 @@ let read_first_line_from_file filename =
|
||||
let line = input_line chan in
|
||||
close_in chan;
|
||||
line
|
||||
|
||||
let is_regular_file path = (* NB: follows symlinks. *)
|
||||
try (Unix.stat path).Unix.st_kind = Unix.S_REG
|
||||
with Unix.Unix_error _ -> false
|
||||
|
||||
@@ -248,3 +248,6 @@ val last_part_of : string -> char -> string option
|
||||
val read_first_line_from_file : string -> string
|
||||
(** Read only the first line (i.e. until the first newline character)
|
||||
of a file. *)
|
||||
|
||||
val is_regular_file : string -> bool
|
||||
(** Checks whether the file is a regular file. *)
|
||||
|
||||
@@ -159,10 +159,6 @@ let find_uefi_firmware guest_arch =
|
||||
in
|
||||
loop files
|
||||
|
||||
let is_regular_file path = (* NB: follows symlinks. *)
|
||||
try (Unix.stat path).Unix.st_kind = Unix.S_REG
|
||||
with Unix.Unix_error _ -> false
|
||||
|
||||
(* Given a path of a file relative to the root of the directory tree
|
||||
* with virtio-win drivers, figure out if it's suitable for the
|
||||
specific Windows flavor of the current guest.
|
||||
|
||||
Reference in New Issue
Block a user