replace removeLink with removeFile

same reasoning as in commit 5cc8d9d03b
This commit is contained in:
Joey Hess 2025-02-11 13:41:26 -04:00
parent 90eb1e2da6
commit f8bb9a8734
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 16 additions and 21 deletions

View file

@ -61,7 +61,7 @@ cleanupOtherTmp = do
tmpdir <- fromRepo gitAnnexTmpOtherDir
void $ liftIO $ tryIO $ removeDirectoryRecursive tmpdir
oldtmp <- fromRepo gitAnnexTmpOtherDirOld
liftIO $ mapM_ (cleanold . fromOsPath)
liftIO $ mapM_ cleanold
=<< emptyWhenDoesNotExist (dirContentsRecursive oldtmp)
-- remove when empty
liftIO $ void $ tryIO $ removeDirectory oldtmp
@ -69,7 +69,7 @@ cleanupOtherTmp = do
cleanold f = do
now <- liftIO getPOSIXTime
let oldenough = now - (60 * 60 * 24 * 7)
catchMaybeIO (modificationTime <$> R.getSymbolicLinkStatus f) >>= \case
catchMaybeIO (modificationTime <$> R.getSymbolicLinkStatus (fromOsPath f)) >>= \case
Just mtime | realToFrac mtime <= oldenough ->
void $ tryIO $ removeWhenExistsWith R.removeLink f
void $ tryIO $ removeWhenExistsWith removeFile f
_ -> return ()