diff --git a/dsc b/dsc index e5703e8..27df3c0 100755 Binary files a/dsc and b/dsc differ diff --git a/imperative-shell/converter.sml b/imperative-shell/converter.sml index 22476b5..4e529c6 100644 --- a/imperative-shell/converter.sml +++ b/imperative-shell/converter.sml @@ -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