packages feed

filepath 1.4.100.0 → 1.4.100.1

raw patch · 4 files changed

+43/−14 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- System.OsPath.Data.ByteString.Short.Internal: decodeWord16LE# :: (# Word#, Word# #) -> Word#
+ System.OsPath.Data.ByteString.Short.Internal: decodeWord16LE# :: (# Word8#, Word8# #) -> Word16#
- System.OsPath.Data.ByteString.Short.Internal: encodeWord16LE# :: Word# -> (# Word#, Word# #)
+ System.OsPath.Data.ByteString.Short.Internal: encodeWord16LE# :: Word16# -> (# Word8#, Word8# #)

Files

System/FilePath/Internal.hs view
@@ -120,7 +120,7 @@ #ifndef OS_PATH import Data.String (fromString) import System.Environment(getEnv)-import Prelude (String, map, FilePath, Eq, IO, id, last, init, reverse, dropWhile, null, break, takeWhile, take, all, elem, any, head, tail, span)+import Prelude (String, map, FilePath, Eq, IO, id, last, init, reverse, dropWhile, null, break, takeWhile, take, all, elem, any, span) import Data.Char(toLower, toUpper, isAsciiLower, isAsciiUpper) import Data.List(stripPrefix, isSuffixOf, uncons) #define CHAR Char@@ -672,9 +672,7 @@   hasLeadingPathSeparator :: FILEPATH -> Bool-hasLeadingPathSeparator x-  | null x = False-  | otherwise = isPathSeparator $ head x+hasLeadingPathSeparator = maybe False (isPathSeparator . fst) . uncons   -- | Add a trailing file path separator if one is not already present.@@ -901,11 +899,21 @@       where (a, b) = break isPathSeparator $ dropWhile isPathSeparator x      -- on windows, need to drop '/' which is kind of absolute, but not a drive-    dropAbs x | not (null x) && isPathSeparator (head x) && not (hasDrive x) = tail x-    dropAbs x = dropDrive x+    dropAbs x+      | Just (hd, tl) <- uncons x+      , isPathSeparator hd+      , not (hasDrive x)+      = tl+      | otherwise+      = dropDrive x -    takeAbs x | not (null x) && isPathSeparator (head x) && not (hasDrive x) = singleton pathSeparator-    takeAbs x = map (\y -> if isPathSeparator y then pathSeparator else toLower y) $ takeDrive x+    takeAbs x+      | Just (hd, _) <- uncons x+      , isPathSeparator hd+      , not (hasDrive x)+      = singleton pathSeparator+      | otherwise+      = map (\y -> if isPathSeparator y then pathSeparator else toLower y) $ takeDrive x  -- | Normalise a file --@@ -955,7 +963,7 @@            then singleton _period            else joinDrive d p -    addPathSeparator = isDirPath filepath+    addPathSeparator = isDirPath pth       && not (hasTrailingPathSeparator result)       && not (isRelativeDrive drv) 
changelog.md view
@@ -2,10 +2,18 @@  _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ +## 1.4.100.1 *Feb 2023*++* Fix regression in `System.FilePath.Windows.normalise` wrt [#187](https://github.com/haskell/filepath/issues/187)+* Fix tests on GHC 9.4.4+* Avoid head and tail+ ## 1.4.100.0 *July 2022*  Implementation of the [Abstract FilePath Proposal](https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/abstract-file-path) in user-space as a separate type.++Introduction to the new API is explained [in this blog post](https://hasufell.github.io/posts/2022-06-29-fixing-haskell-filepaths.html).  ## 1.4.2.2 *Dec 2021* 
filepath.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               filepath-version:            1.4.100.0+version:            1.4.100.1  -- NOTE: Don't forget to update ./changelog.md license:            BSD-3-Clause@@ -8,9 +8,9 @@ author:             Neil Mitchell <ndmitchell@gmail.com> maintainer:         Julian Ospald <hasufell@posteo.de> copyright:          Neil Mitchell 2005-2020, Julain Ospald 2021-2022-bug-reports:        https://gitlab.haskell.org/haskell/filepath/-/issues+bug-reports:        https://github.com/haskell/filepath/issues homepage:-  https://gitlab.haskell.org/haskell/filepath/-/blob/master/README.md+  https://github.com/haskell/filepath/blob/master/README.md  category:           System build-type:         Simple@@ -44,6 +44,10 @@   .   "System.OsString" is like "System.OsPath", but more general purpose. Refer to the documentation of   those modules for more information.+  .+  An introduction into the new API can be found in this+  <https://hasufell.github.io/posts/2022-06-29-fixing-haskell-filepaths.html blog post>.+  Code examples for the new API can be found <https://github.com/hasufell/filepath-examples here>.  extra-source-files:   Generate.hs@@ -65,7 +69,7 @@  source-repository head   type:     git-  location: https://gitlab.haskell.org/haskell/filepath+  location: https://github.com/haskell/filepath  library   exposed-modules:@@ -99,7 +103,7 @@    default-language: Haskell2010   build-depends:-    , base              >=4.9      && <4.18+    , base              >=4.9      && <4.19     , bytestring        >=0.11.3.0     , deepseq     , exceptions
tests/abstract-filepath/EncodingSpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeApplications #-}@@ -38,7 +39,11 @@       let str = [toEnum 55296, toEnum 55297]           encoded = encodeWithTE utf16le str           decoded = decodeWithTE utf16le =<< encoded+#if __GLASGOW_HASKELL__ >= 904+      in decoded === Left (EncodingError ("recoverEncode: invalid argument (cannot encode character " <> show (head str) <> ")") Nothing))+#else       in decoded === Left (EncodingError "recoverEncode: invalid argument (invalid character)" Nothing))+#endif   , ("ucs2 handles invalid surrogate pairs",      property $       let str = [toEnum 55296, toEnum 55297]@@ -64,7 +69,11 @@       let str = [toEnum 0xDFF0, toEnum 0xDFF2]           encoded = encodeWithTE (mkUTF8 RoundtripFailure) str           decoded = decodeWithTE (mkUTF8 RoundtripFailure) =<< encoded+#if __GLASGOW_HASKELL__ >= 904+      in decoded === Left (EncodingError ("recoverEncode: invalid argument (cannot encode character " <> show (head str) <> ")") Nothing))+#else       in decoded === Left (EncodingError "recoverEncode: invalid argument (invalid character)" Nothing))+#endif    , ("cannot roundtrip arbitrary bytes through utf-16 (with RoundtripFailure)",      property $