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
|
||||
-
|
||||
- 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>
|
||||
-
|
||||
|
@ -17,12 +24,9 @@ import System.Posix.Files.ByteString
|
|||
import System.Posix.ByteString.FilePath
|
||||
#else
|
||||
import qualified Data.ByteString as B
|
||||
import System.IO.Error
|
||||
|
||||
type RawFilePath = B.ByteString
|
||||
import qualified System.PosixCompat as P
|
||||
import Utility.FileSystemEncoding
|
||||
|
||||
readSymbolicLink :: RawFilePath -> IO RawFilePath
|
||||
readSymbolicLink _ = ioError $ mkIOError illegalOperationErrorType x Nothing Nothing
|
||||
where
|
||||
x = "Utility.RawFilePath.readSymbolicLink: not supported"
|
||||
readSymbolicLink f = toRawFilePath <$> P.readSymbolicLink (fromRawFilePath f)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue