use conversion functions from filepath-bytestring

Behavior should be the same, but I'd hope to eventually get rid of
most of Utility.FileSystemEncoding and this is a first step.
This commit is contained in:
Joey Hess 2019-12-18 13:33:18 -04:00
parent 322c542b5c
commit 75c40279c1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 6 additions and 18 deletions

View file

@ -43,6 +43,7 @@ import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.UTF8 as S8 import qualified Data.ByteString.UTF8 as S8
import qualified Data.ByteString.Lazy.UTF8 as L8 import qualified Data.ByteString.Lazy.UTF8 as L8
#endif #endif
import System.FilePath.ByteString (RawFilePath, encodeFilePath, decodeFilePath)
import Utility.Exception import Utility.Exception
import Utility.Split import Utility.Split
@ -171,21 +172,11 @@ encodeBL' = L.pack . decodeW8
encodeBL' = L8.fromString encodeBL' = L8.fromString
#endif #endif
{- Recent versions of the unix package have this alias; defined here
- for backwards compatibility. -}
type RawFilePath = S.ByteString
{- Note that the RawFilePath is assumed to never contain NUL,
- since filename's don't. This should only be used with actual
- RawFilePaths not arbitrary ByteString that may contain NUL. -}
fromRawFilePath :: RawFilePath -> FilePath fromRawFilePath :: RawFilePath -> FilePath
fromRawFilePath = decodeBS' fromRawFilePath = decodeFilePath
{- Note that the FilePath is assumed to never contain NUL,
- since filename's don't. This should only be used with actual FilePaths
- not arbitrary String that may contain NUL. -}
toRawFilePath :: FilePath -> RawFilePath toRawFilePath :: FilePath -> RawFilePath
toRawFilePath = encodeBS' toRawFilePath = encodeFilePath
{- Converts a [Word8] to a FilePath, encoding using the filesystem encoding. {- Converts a [Word8] to a FilePath, encoding using the filesystem encoding.
- -

View file

@ -9,10 +9,7 @@ Benchmarking `git-annex find`, speedups range from 28-66%. The files fly by
much more snappily. Other commands likely also speed up, but do more work much more snappily. Other commands likely also speed up, but do more work
than find so the improvement is not as large. than find so the improvement is not as large.
The `bs` branch is in a mergeable state now, except for: The `bs` branch is in a mergeable state now.
* filepath-bytestring probably has issues with utf16 filenames
on Windows. See its TODO.
Stuff not entirely finished: Stuff not entirely finished:

View file

@ -320,7 +320,7 @@ Executable git-annex
directory (>= 1.2), directory (>= 1.2),
disk-free-space, disk-free-space,
filepath, filepath,
filepath-bytestring, filepath-bytestring (>= 1.4.2.1.1),
IfElse, IfElse,
hslogger, hslogger,
monad-logger, monad-logger,

View file

@ -24,7 +24,7 @@ extra-deps:
- sandi-0.5 - sandi-0.5
- http-client-0.5.14 - http-client-0.5.14
- silently-1.2.5.1 - silently-1.2.5.1
- filepath-bytestring-1.4.2.1.0 - filepath-bytestring-1.4.2.1.1
explicit-setup-deps: explicit-setup-deps:
git-annex: true git-annex: true
resolver: lts-13.29 resolver: lts-13.29