RawFilePath will need to support Windows too
Of course, readSymbolicLink always fails on Windows, but now it's ready for other things that don't fail there.
This commit is contained in:
parent
f39f018ee0
commit
360942ba12
1 changed files with 10 additions and 6 deletions
|
@ -1,4 +1,11 @@
|
||||||
{- Portability shim around System.Posix.Files.ByteString
|
{- Portability shim around System.Posix.Files.ByteString
|
||||||
|
-
|
||||||
|
- On unix, this makes syscalls using RawFilesPaths as efficiently as
|
||||||
|
- possible.
|
||||||
|
-
|
||||||
|
- On Windows, filenames are in unicode, so RawFilePaths have to be
|
||||||
|
- decoded. So this library will work, but less efficiently than using
|
||||||
|
- FilePath would.
|
||||||
-
|
-
|
||||||
- Copyright 2019 Joey Hess <id@joeyh.name>
|
- Copyright 2019 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
|
@ -17,12 +24,9 @@ import System.Posix.Files.ByteString
|
||||||
import System.Posix.ByteString.FilePath
|
import System.Posix.ByteString.FilePath
|
||||||
#else
|
#else
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import System.IO.Error
|
import qualified System.PosixCompat as P
|
||||||
|
import Utility.FileSystemEncoding
|
||||||
type RawFilePath = B.ByteString
|
|
||||||
|
|
||||||
readSymbolicLink :: RawFilePath -> IO RawFilePath
|
readSymbolicLink :: RawFilePath -> IO RawFilePath
|
||||||
readSymbolicLink _ = ioError $ mkIOError illegalOperationErrorType x Nothing Nothing
|
readSymbolicLink f = toRawFilePath <$> P.readSymbolicLink (fromRawFilePath f)
|
||||||
where
|
|
||||||
x = "Utility.RawFilePath.readSymbolicLink: not supported"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue