more RawFilePath conversion

Most of Git/ builds now.

Notable win is toTopFilePath no longer double converts

This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
Joey Hess 2020-10-28 15:40:50 -04:00
parent d6e94a6b2e
commit 08cbaee1f8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
15 changed files with 105 additions and 76 deletions

View file

@ -10,7 +10,6 @@
module Config.Files where
import Common
import Utility.Tmp
import Utility.FreeDesktop
{- ~/.config/git-annex/file -}

View file

@ -12,8 +12,7 @@ module Config.Files.AutoStart where
import Common
import Config.Files
import Utility.Tmp
import Utility.FreeDesktop
import Utility.Directory.AbsRel
import Utility.Path.AbsRel
{- Returns anything listed in the autostart file (which may not exist). -}
readAutoStartFile :: IO [FilePath]
@ -31,7 +30,8 @@ modifyAutoStartFile func = do
let dirs' = nubBy equalFilePath $ func dirs
when (dirs' /= dirs) $ do
f <- autoStartFile
createDirectoryIfMissing True (parentDir f)
createDirectoryIfMissing True $
fromRawFilePath (parentDir (toRawFilePath f))
viaTmp writeFile f $ unlines dirs'
{- Adds a directory to the autostart file. If the directory is already
@ -39,12 +39,12 @@ modifyAutoStartFile func = do
- when opening the webapp. -}
addAutoStartFile :: FilePath -> IO ()
addAutoStartFile path = do
path' <- absPath path
path' <- fromRawFilePath <$> absPath (toRawFilePath path)
modifyAutoStartFile $ (:) path'
{- Removes a directory from the autostart file. -}
removeAutoStartFile :: FilePath -> IO ()
removeAutoStartFile path = do
path' <- absPath path
path' <- fromRawFilePath <$> absPath (toRawFilePath path)
modifyAutoStartFile $
filter (not . equalFilePath path')