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
|
||||
v <- ifM (coreSymlinks <$> Annex.getGitConfig)
|
||||
( liftIO $ catchMaybeIO $ readSymbolicLink file
|
||||
, liftIO $ catchMaybeIO $ take 8192 <$> readFile file
|
||||
, liftIO $ catchMaybeIO $ readfilestart file
|
||||
)
|
||||
case v of
|
||||
Nothing -> return Nothing
|
||||
Just l
|
||||
| isLinkToAnnex l -> return v
|
||||
| otherwise -> return Nothing
|
||||
where
|
||||
readfilestart f = do
|
||||
h <- openFile f ReadMode
|
||||
fileEncoding h
|
||||
take 8192 <$> hGetContents h
|
||||
|
||||
{- Creates a link on disk.
|
||||
-
|
||||
|
|
Loading…
Add table
Reference in a new issue