filepath 1.2.0.1 → 1.3.0.0
raw patch · 5 files changed
+28/−16 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- System/FilePath.hs +3/−2
- System/FilePath/Internal.hs +18/−13
- System/FilePath/Posix.hs +3/−0
- System/FilePath/Windows.hs +3/−0
- filepath.cabal +1/−1
System/FilePath.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif {- | Module : System.FilePath Copyright : (c) Neil Mitchell 2005-2007@@ -23,6 +26,4 @@ module System.FilePath(module System.FilePath.Posix) where import System.FilePath.Posix #endif--
System/FilePath/Internal.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif -- -- Some short examples: --@@ -697,13 +701,17 @@ -- > normalise "." == "." -- > Posix: normalise "./" == "./" -- > Posix: normalise "./." == "./"+-- > Posix: normalise "/" == "/" -- > Posix: normalise "bob/fred/." == "bob/fred/" normalise :: FilePath -> FilePath-normalise path = joinDrive (normaliseDrive drv) (f pth)+normalise path = joinDrive' (normaliseDrive drv) (f pth) ++ [pathSeparator | isDirPath pth] where (drv,pth) = splitDrive path + joinDrive' "" "" = "."+ joinDrive' d p = joinDrive d p+ isDirPath xs = lastSep xs || not (null xs) && last xs == '.' && lastSep (init xs) lastSep xs = not (null xs) && isPathSeparator (last xs)@@ -717,12 +725,7 @@ propSep (x:xs) = x : propSep xs propSep [] = [] - dropDots xs | all (== ".") xs = ["."]- dropDots xs = dropDots' [] xs-- dropDots' acc (".":xs) = dropDots' acc xs- dropDots' acc (x:xs) = dropDots' (x:acc) xs- dropDots' acc [] = reverse acc+ dropDots = filter ("." /=) normaliseDrive :: FilePath -> FilePath normaliseDrive drive | isPosix = drive@@ -810,12 +813,14 @@ isRelative = isRelativeDrive . takeDrive --- > isRelativeDrive "" == True--- > Windows: isRelativeDrive "c:\\" == False--- > Windows: isRelativeDrive "c:/" == False--- > Windows: isRelativeDrive "c:" == True--- > Windows: isRelativeDrive "\\\\foo" == False--- > Posix: isRelativeDrive "/" == False+-- Disable these tests for now, as we want to be able to run the+-- testsuite without doing a special TESTING compilation+-- -- > isRelativeDrive "" == True+-- -- > Windows: isRelativeDrive "c:\\" == False+-- -- > Windows: isRelativeDrive "c:/" == False+-- -- > Windows: isRelativeDrive "c:" == True+-- -- > Windows: isRelativeDrive "\\\\foo" == False+-- -- > Posix: isRelativeDrive "/" == False isRelativeDrive :: String -> Bool isRelativeDrive x = null x || maybe False (not . isPathSeparator . last . fst) (readDriveLetter x)
System/FilePath/Posix.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif #define MODULE_NAME Posix #define IS_WINDOWS False
System/FilePath/Windows.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif #define MODULE_NAME Windows #define IS_WINDOWS True
filepath.cabal view
@@ -1,5 +1,5 @@ Name: filepath-Version: 1.2.0.1+Version: 1.3.0.0 License: BSD3 license-file: LICENSE Author: Neil Mitchell