directory 1.3.8.2 → 1.3.8.3
raw patch · 7 files changed
+38/−21 lines, 7 filesdep ~basedep ~filepathdep ~timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, filepath, time
API changes (from Hackage documentation)
- System.Directory.Internal: canonicalizePathWith :: ((OsPath -> IO OsPath) -> OsPath -> IO OsPath) -> OsPath -> IO OsPath
+ System.Directory.Internal: realPath :: OsPath -> IO OsPath
- System.Directory.Internal: data OsString
+ System.Directory.Internal: data () => OsString
Files
- System/Directory/Internal/Posix.hsc +4/−8
- System/Directory/Internal/Windows.hsc +4/−5
- System/Directory/OsPath.hs +2/−2
- changelog.md +7/−0
- directory.cabal +6/−4
- tests/CanonicalizePath.hs +11/−0
- tests/FindFile001.hs +4/−2
System/Directory/Internal/Posix.hsc view
@@ -81,14 +81,10 @@ allocaBytes (pathMax + 1) (realpath >=> action) where realpath = throwErrnoIfNull "" . c_realpath path -canonicalizePathWith :: ((OsPath -> IO OsPath) -> OsPath -> IO OsPath)- -> OsPath- -> IO OsPath-canonicalizePathWith attemptRealpath path = do- let realpath (OsString path') =- Posix.withFilePath path'- (`withRealpath` ((OsString <$>) . Posix.peekFilePath))- attemptRealpath realpath path+realPath :: OsPath -> IO OsPath+realPath (OsString path') =+ Posix.withFilePath path'+ (`withRealpath` ((OsString <$>) . Posix.peekFilePath)) canonicalizePathSimplify :: OsPath -> IO OsPath canonicalizePathSimplify = pure
System/Directory/Internal/Windows.hsc view
@@ -356,7 +356,8 @@ | (toChar <$> [c1, c2, c3, c4]) == "\\\\?\\" -> case path of c5 : c6 : c7 : subpath@(c8 : _)- | (toChar <$> [c5, c6, c7, c8]) == "UNC\\" -> pack subpath+ | (toChar <$> [c5, c6, c7, c8]) == "UNC\\" ->+ os "\\" <> pack subpath drive : col : subpath -- if the path is not "regular", then the prefix is necessary -- to ensure the path is interpreted literally@@ -407,10 +408,8 @@ Left proposedSize -> peekTStringWith proposedSize cFunc Right result -> pure result -canonicalizePathWith :: ((OsPath -> IO OsPath) -> OsPath -> IO OsPath)- -> OsPath- -> IO OsPath-canonicalizePathWith attemptRealpath = attemptRealpath getFinalPathName+realPath :: OsPath -> IO OsPath+realPath = getFinalPathName canonicalizePathSimplify :: OsPath -> IO OsPath canonicalizePathSimplify path =
System/Directory/OsPath.hs view
@@ -10,7 +10,7 @@ -- -- System-independent interface to directory manipulation. ----- @since 1.2.8.0+-- @since 1.3.8.0 -- ----------------------------------------------------------------------------- @@ -872,7 +872,7 @@ (`ioeSetOsPath` path)) `modifyIOError` do -- simplify does more stuff, like upper-casing the drive letter dropTrailingPathSeparator . simplify <$>- (canonicalizePathWith attemptRealpath =<< prependCurrentDirectory path)+ (attemptRealpath realPath =<< prependCurrentDirectory path) where -- allow up to 64 cycles before giving up
changelog.md view
@@ -1,6 +1,13 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.8.3 (Jan 2024)++ * Relax `Win32` version bounds to support 2.14.0.0.+ ([#166](https://github.com/haskell/directory/issues/166))+ * Fix regression in `canonicalizePath` on Windows UNC paths.+ ([#170](https://github.com/haskell/directory/issues/170))+ ## 1.3.8.2 (Dec 2023) * Relax `base` version bounds to support 4.19.
directory.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: directory-version: 1.3.8.2+version: 1.3.8.3 license: BSD-3-Clause license-file: LICENSE maintainer: libraries@haskell.org@@ -19,11 +19,13 @@ config.status HsDirectoryConfig.h +extra-doc-files:+ README.md+ changelog.md+ extra-source-files: HsDirectoryConfig.h.in- README.md System/Directory/Internal/*.h- changelog.md configure configure.ac directory.buildinfo@@ -61,7 +63,7 @@ base >= 4.11.0 && < 4.20, time >= 1.8.0 && < 1.13 if os(windows)- build-depends: Win32 >= 2.13.3 && < 2.14+ build-depends: Win32 >= 2.13.3 && < 2.15 else build-depends: unix >= 2.8.0 && < 2.9
tests/CanonicalizePath.hs view
@@ -160,3 +160,14 @@ vldn <- canonicalizePath "verylongdirectoryname" vldn2 <- canonicalizePath "VERYLONGDIRECTORYNAME" T(expectEq) () vldn vldn2++ let isWindows =+#if defined(mingw32_HOST_OS)+ True+#else+ False+#endif++ when isWindows $ do+ -- https://github.com/haskell/directory/issues/170+ T(expectEq) () "\\\\localhost" =<< canonicalizePath "\\\\localhost"
tests/FindFile001.hs view
@@ -28,13 +28,15 @@ for_ (List.permutations ["qux", "bar", "."]) $ \ ds -> do let (match, noMatch) = List.partition (== "qux") ds+ match0 : _ <- pure match+ noMatch0 : _ <- pure noMatch - T(expectEq) ds (Just (List.head match </> "foo")) =<<+ T(expectEq) ds (Just (match0 </> "foo")) =<< findFileWith f ds "foo" T(expectEq) ds ((</> "foo") <$> match) =<< findFilesWith f ds "foo" - T(expectEq) ds (Just (List.head noMatch </> "foo")) =<<+ T(expectEq) ds (Just (noMatch0 </> "foo")) =<< findFileWith ((not <$>) . f) ds "foo" T(expectEq) ds ((</> "foo") <$> noMatch) =<<