3 let is_dir path
= try Some
(Sys.is_directory path
) with exn
-> None
4 let read_dir path
= try Sys.readdir path
with exn
-> [||]
6 let rec of_dir path l
=
7 let names = read_dir path
in
8 let fullname name
= Filename.concat path name
in
9 Array.fold_left
(fun ll name
-> add_entry
(fullname name
) ll
) l
names
11 add_entry path
(l1
,l2
) =
12 match is_dir path
with
13 | Some
true -> of_dir path
(l1
,l2
)
14 | Some
false -> let z1,z2
= xsd_of_file path
in (z1@l1
),(z2
@l2
)
18 let b = (String.starts_with str
"/") || (String.starts_with str
"\\") in
19 let s = String.strip ~chars
:"/\\" str
in
20 if b then "\\" ^
s else s