progress with converter, as we now visit each directory and file path recursively
This commit is contained in:
@@ -18,20 +18,24 @@ struct
|
||||
SOME path =>
|
||||
let
|
||||
val folderPath = String.concat [rootPath, "/", path]
|
||||
val () = print (folderPath ^ "\n")
|
||||
val () =
|
||||
if OS.FileSys.isDir folderPath then
|
||||
(* handle recursive directory *)
|
||||
let val newDir = OS.FileSys.openDir folderPath
|
||||
in loop (newDir, folderPath)
|
||||
end
|
||||
else if OS.FileSys.isLink folderPath then
|
||||
(* ignore *)
|
||||
()
|
||||
else if endsWithDsc path then
|
||||
(* is a file ending with .dsc extension *)
|
||||
convertFile folderPath
|
||||
else
|
||||
(* is a file but doesn't end with .dsc, so ignore *)
|
||||
()
|
||||
in
|
||||
if OS.FileSys.isDir folderPath then
|
||||
(* handle folder *)
|
||||
let val newDir = OS.fileSys.openDir folderPath
|
||||
in loop (newDir, folderPath)
|
||||
end
|
||||
else if OS.FileSys.isLink folderPath then
|
||||
(* continue looping and ignore *)
|
||||
loop (dir, rootPath)
|
||||
else
|
||||
(* handle file, if file has ".dsc" at the end *)
|
||||
let val () = if endsWithDsc path then convertFile folderPath else ()
|
||||
in loop (dir, rootPath)
|
||||
end
|
||||
loop (dir, rootPath)
|
||||
end
|
||||
| NONE => OS.FileSys.closeDir dir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user