projects
/
haskell-directory.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-10-24 07:49:40 by mthomas]
[haskell-directory.git]
/
System
/
Directory.hs
diff --git
a/System/Directory.hs
b/System/Directory.hs
index
911ff4e
..
0ddd3d2
100644
(file)
--- a/
System/Directory.hs
+++ b/
System/Directory.hs
@@
-560,7
+560,7
@@
getModificationTime name =
withFileStatus :: FilePath -> (Ptr CStat -> IO a) -> IO a
withFileStatus name f = do
allocaBytes sizeof_stat $ \p ->
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
throwErrnoIfMinus1Retry_ "withFileStatus" (c_stat s p)
f p
@@
-581,6
+581,16
@@
isDirectory stat = do
mode <- st_mode stat
return (s_isdir mode)
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
emptyCMode :: CMode
emptyCMode = 0