X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FDirectory.hs;h=beed8798cca5fa154974083563baaaf4055361f4;hb=30c6a57ac9dfc3808a28bb2654912aa7460568c8;hp=1d63bde809152fe724e479da1bbf5341c7c79fc5;hpb=56e0a42849406ad2e3038f9185bf12691befd949;p=haskell-directory.git diff --git a/System/Directory.hs b/System/Directory.hs index 1d63bde..beed879 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -39,6 +39,7 @@ module System.Directory , copyFile -- :: FilePath -> FilePath -> IO () , canonicalizePath + , makeRelativeToCurrentDirectory , findExecutable -- * Existence tests @@ -67,6 +68,7 @@ module System.Directory import System.Directory.Internals import System.Environment ( getEnv ) +import System.FilePath import System.IO.Error import Control.Monad ( when, unless ) @@ -596,6 +598,12 @@ foreign import ccall unsafe "realpath" -> IO CString #endif +-- | 'makeRelative' the current directory. +makeRelativeToCurrentDirectory :: FilePath -> IO FilePath +makeRelativeToCurrentDirectory x = do + cur <- getCurrentDirectory + return $ makeRelative cur x + -- | Given an executable file name, searches for such file -- in the directories listed in system PATH. The returned value -- is the path to the found executable or Nothing if there isn't @@ -875,7 +883,7 @@ foreign import ccall unsafe "__hscore_long_path_size" #else long_path_size :: Int -long_path_size = 2048 /* guess? */ +long_path_size = 2048 -- // guess? #endif /* __GLASGOW_HASKELL__ */