projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f3fb841
)
FIX #2963: Use System.Win32.getCurrentDirectory
author
Simon Marlow
<marlowsd@gmail.com>
Wed, 11 Mar 2009 11:37:37 +0000
(11:37 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Wed, 11 Mar 2009 11:37:37 +0000
(11:37 +0000)
System/Directory.hs
patch
|
blob
|
history
diff --git
a/System/Directory.hs
b/System/Directory.hs
index
7cfb090
..
ec79997
100644
(file)
--- a/
System/Directory.hs
+++ b/
System/Directory.hs
@@
-800,30
+800,11
@@
The operating system has no notion of current directory.
getCurrentDirectory :: IO FilePath
getCurrentDirectory = do
#ifdef mingw32_HOST_OS
getCurrentDirectory :: IO FilePath
getCurrentDirectory = do
#ifdef mingw32_HOST_OS
- -- XXX: should use something from Win32
- p <- mallocBytes long_path_size
- go p long_path_size
- where go p bytes = do
- p' <- c_getcwd p (fromIntegral bytes)
- if p' /= nullPtr
- then do s <- peekCString p'
- free p'
- return s
- else do errno <- getErrno
- if errno == eRANGE
- then do let bytes' = bytes * 2
- p'' <- reallocBytes p bytes'
- go p'' bytes'
- else throwErrno "getCurrentDirectory"
+ System.Win32.getCurrentDirectory
#else
System.Posix.getWorkingDirectory
#endif
#else
System.Posix.getWorkingDirectory
#endif
-#ifdef mingw32_HOST_OS
-foreign import ccall unsafe "getcwd"
- c_getcwd :: Ptr CChar -> CSize -> IO (Ptr CChar)
-#endif
-
{- |If the operating system has a notion of current directories,
@'setCurrentDirectory' dir@ changes the current
directory of the calling process to /dir/.
{- |If the operating system has a notion of current directories,
@'setCurrentDirectory' dir@ changes the current
directory of the calling process to /dir/.