set fileSystemEncoding when reading files that might be binary
This commit is contained in:
parent
bd99730d77
commit
d799ef3182
1 changed files with 6 additions and 1 deletions
|
@ -38,13 +38,18 @@ getAnnexLinkTarget :: FilePath -> Annex (Maybe LinkTarget)
|
||||||
getAnnexLinkTarget file = do
|
getAnnexLinkTarget file = do
|
||||||
v <- ifM (coreSymlinks <$> Annex.getGitConfig)
|
v <- ifM (coreSymlinks <$> Annex.getGitConfig)
|
||||||
( liftIO $ catchMaybeIO $ readSymbolicLink file
|
( liftIO $ catchMaybeIO $ readSymbolicLink file
|
||||||
, liftIO $ catchMaybeIO $ take 8192 <$> readFile file
|
, liftIO $ catchMaybeIO $ readfilestart file
|
||||||
)
|
)
|
||||||
case v of
|
case v of
|
||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
Just l
|
Just l
|
||||||
| isLinkToAnnex l -> return v
|
| isLinkToAnnex l -> return v
|
||||||
| otherwise -> return Nothing
|
| otherwise -> return Nothing
|
||||||
|
where
|
||||||
|
readfilestart f = do
|
||||||
|
h <- openFile f ReadMode
|
||||||
|
fileEncoding h
|
||||||
|
take 8192 <$> hGetContents h
|
||||||
|
|
||||||
{- Creates a link on disk.
|
{- Creates a link on disk.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue