[project @ 2002-10-24 07:49:40 by mthomas]
authormthomas <unknown>
Thu, 24 Oct 2002 07:49:40 +0000 (07:49 +0000)
committermthomas <unknown>
Thu, 24 Oct 2002 07:49:40 +0000 (07:49 +0000)
Unchecked quick fix. Hope to test tonight after getting home.

System/Directory.hs

index 911ff4e..0ddd3d2 100644 (file)
@@ -560,7 +560,7 @@ getModificationTime name =
 withFileStatus :: FilePath -> (Ptr CStat -> IO a) -> IO a
 withFileStatus name f = do
     allocaBytes sizeof_stat $ \p ->
-      withCString name $ \s -> do
+      withCString (fileNameEndClean name) $ \s -> do
         throwErrnoIfMinus1Retry_ "withFileStatus" (c_stat s p)
        f p
 
@@ -581,6 +581,16 @@ isDirectory stat = do
   mode <- st_mode stat
   return (s_isdir mode)
 
+fileNameEndClean :: String -> String
+fileNameEndClean name = 
+  if i >= 0 && (ec == '\\' || ec == '/') then 
+     fileNameEndClean (take i name)
+   else
+     name
+  where
+      i  = (length name) - 1
+      ec = name !! i
+
 emptyCMode     :: CMode
 emptyCMode     = 0