system-filepath 0.4.11 → 0.4.12
raw patch · 4 files changed
+15/−3 lines, 4 files
Files
- lib/Filesystem/Path.hs +2/−0
- lib/Filesystem/Path/Internal.hs +2/−0
- lib/Filesystem/Path/Rules.hs +9/−1
- system-filepath.cabal +2/−2
lib/Filesystem/Path.hs view
@@ -153,6 +153,7 @@ Just RootWindowsVolume{} -> True Just RootWindowsCurrentVolume -> False Just RootWindowsUnc{} -> True+ Just RootWindowsDoubleQMark -> True Nothing -> False -- | Test whether a path is relative.@@ -176,6 +177,7 @@ Just RootWindowsVolume{} -> y { pathRoot = pathRoot x } _ -> y Just RootWindowsUnc{} -> y+ Just RootWindowsDoubleQMark -> y Nothing -> xy xy = y { pathRoot = pathRoot x
lib/Filesystem/Path/Internal.hs view
@@ -41,6 +41,7 @@ | RootWindowsVolume Char Bool | RootWindowsCurrentVolume | RootWindowsUnc String String Bool+ | RootWindowsDoubleQMark deriving (Eq, Ord, Data, Typeable, Show) data FilePath = FilePath@@ -95,6 +96,7 @@ RootWindowsCurrentVolume -> "\\" RootWindowsUnc host share False -> "\\\\" ++ host ++ "\\" ++ share RootWindowsUnc host share True -> "\\\\?\\UNC\\" ++ host ++ "\\" ++ share+ RootWindowsDoubleQMark -> "\\??\\" rootText :: Maybe Root -> T.Text rootText = T.pack . rootChunk
lib/Filesystem/Path/Rules.hs view
@@ -304,7 +304,9 @@ Nothing -> case T.stripPrefix (T.pack "\\\\") text of Just stripped -> parseUncRoot stripped False Nothing -> parseDosRoot text False- else parseDosRoot text False+ else case T.stripPrefix (T.pack "\\??\\") text of+ Just stripped -> parseDoubleQmark stripped+ Nothing -> parseDosRoot text False (directories, filename) | P.null pastRoot = ([], Nothing)@@ -339,6 +341,10 @@ parseDrive c = RootWindowsVolume (toUpper (T.head c)) extended +parseDoubleQmark :: T.Text -> (Maybe Root, [T.Text])+parseDoubleQmark text = (Just RootWindowsDoubleQMark, components) where+ components = textSplitBy (\c -> c == '/' || c == '\\') text+ parseUncRoot :: T.Text -> Bool -> (Maybe Root, [T.Text]) parseUncRoot text extended = parsed where (host, pastHost) = T.break (== '\\') text@@ -354,6 +360,8 @@ Just RootWindowsCurrentVolume -> dosValid p Just (RootWindowsVolume v _) -> elem v ['A'..'Z'] && dosValid p Just (RootWindowsUnc host share _) -> uncValid p host share+ -- don't even try to validate \??\ paths+ Just RootWindowsDoubleQMark -> True Just RootPosix -> False dosValid :: FilePath -> Bool
system-filepath.cabal view
@@ -1,5 +1,5 @@ name: system-filepath-version: 0.4.11+version: 0.4.12 synopsis: High-level, byte-based file and directory path manipulations license: MIT license-file: license.txt@@ -20,7 +20,7 @@ source-repository this type: git location: https://john-millikin.com/code/haskell-filesystem/- tag: system-filepath_0.4.11+ tag: system-filepath_0.4.12 library ghc-options: -Wall -O2