progress with converter, as we now visit each directory and file path recursively

This commit is contained in:
2025-08-26 14:35:35 +01:00
parent 2080118568
commit 2070b30c7d
2 changed files with 17 additions and 13 deletions

BIN
dsc

Binary file not shown.

View File

@@ -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