X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FDirectory.hs;h=ec79997da60b49b333bb85dc8bdbc0c7ad966982;hb=9ba6942c1da0e671cd51795a4d31edd34b2f755a;hp=7cfb090048bda874acf235f9137e49d9e39f2f56;hpb=f3fb841cc2ccbf117d4ccb45669026e052b05549;p=haskell-directory.git diff --git a/System/Directory.hs b/System/Directory.hs index 7cfb090..ec79997 100644 --- 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 - -- 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 -#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/.