[MLton-commit] r7390

Wesley Terpstra wesley at mlton.org
Thu Jan 7 14:13:30 PST 2010


I guess no one has ever used this function!
The files listed in a directory do not include their path, so stat fails.
Combine the directory and filename to form a valid absolute path for stat.


----------------------------------------------------------------------

U   mlton/trunk/lib/mlton/basic/dir.sml

----------------------------------------------------------------------

Modified: mlton/trunk/lib/mlton/basic/dir.sml
===================================================================
--- mlton/trunk/lib/mlton/basic/dir.sml	2010-01-07 19:44:59 UTC (rev 7389)
+++ mlton/trunk/lib/mlton/basic/dir.sml	2010-01-07 22:13:30 UTC (rev 7390)
@@ -54,11 +54,15 @@
 
 fun ls d =
    fold (d, ([], []), fn (x, (dirs, files)) =>
-         if FS.isLink x
+      let
+         val file = OS.Path.joinDirFile { dir=d, file=x }
+      in
+         if FS.isLink file
             then (dirs, files)
-         else if isDir x
+         else if isDir file
                  then (x :: dirs, files)
-              else (dirs, x :: files))
+              else (dirs, x :: files)
+      end)
 
 val lsDirs = #1 o ls
 val lsFiles = #2 o ls




More information about the MLton-commit mailing list