avoid too long temp dir template
The filename might be at or close to the filename length limit, so using it as the template for the temp dir would then fail.
This commit is contained in:
parent
969d54f914
commit
6e71094e7d
1 changed files with 2 additions and 1 deletions
|
@ -27,7 +27,8 @@ replaceFile :: FilePath -> (FilePath -> Annex ()) -> Annex ()
|
||||||
replaceFile file action = do
|
replaceFile file action = do
|
||||||
misctmpdir <- fromRepo gitAnnexTmpMiscDir
|
misctmpdir <- fromRepo gitAnnexTmpMiscDir
|
||||||
void $ createAnnexDirectory misctmpdir
|
void $ createAnnexDirectory misctmpdir
|
||||||
let basetmp = takeFileName file
|
filemax <- liftIO $ fileNameLengthLimit misctmpdir
|
||||||
|
let basetmp = take (filemax `div` 2) (takeFileName file)
|
||||||
withTmpDirIn misctmpdir basetmp $ \tmpdir -> do
|
withTmpDirIn misctmpdir basetmp $ \tmpdir -> do
|
||||||
let tmpfile = tmpdir <> basetmp
|
let tmpfile = tmpdir <> basetmp
|
||||||
action tmpfile
|
action tmpfile
|
||||||
|
|
Loading…
Reference in a new issue