more OsPath conversion

Git.Types now uses it, as does TopFilePath, making for plenty of new
compile errors needing fixing.

Sponsored-by: Brock Spratlen
This commit is contained in:
Joey Hess 2025-01-23 16:15:00 -04:00
parent 12660314f1
commit ea775baccd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
22 changed files with 159 additions and 163 deletions

View file

@ -9,28 +9,27 @@
module Config.Files where
import Common
import Utility.FreeDesktop
import Utility.Exception
import System.FilePath
{- ~/.config/git-annex/file -}
userConfigFile :: FilePath -> IO FilePath
userConfigFile :: OsPath -> IO OsPath
userConfigFile file = do
dir <- userConfigDir
return $ dir </> "git-annex" </> file
dir <- toOsPath <$> userConfigDir
return $ dir </> literalOsPath "git-annex" </> file
autoStartFile :: IO FilePath
autoStartFile = userConfigFile "autostart"
autoStartFile :: IO OsPath
autoStartFile = userConfigFile (literalOsPath "autostart")
{- The path to git-annex is written here; which is useful when something
- has installed it to some awful non-PATH location. -}
programFile :: IO FilePath
programFile = userConfigFile "program"
programFile :: IO OsPath
programFile = userConfigFile (literalOsPath "program")
{- A .noannex file in a git repository prevents git-annex from
- initializing that repository. The content of the file is returned. -}
noAnnexFileContent :: Maybe FilePath -> IO (Maybe String)
noAnnexFileContent :: Maybe OsPath -> IO (Maybe String)
noAnnexFileContent repoworktree = case repoworktree of
Nothing -> return Nothing
Just wt -> catchMaybeIO (readFile (wt </> ".noannex"))
Just wt -> catchMaybeIO (readFile (fromOsPath (wt </> literalOsPath ".noannex")))