2013-04-23 15:38:52 +00:00
|
|
|
{- git-annex extra config files
|
2012-08-02 04:42:33 +00:00
|
|
|
-
|
2019-02-05 18:43:23 +00:00
|
|
|
- Copyright 2012-2019 Joey Hess <id@joeyh.name>
|
2012-08-02 04:42:33 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2012-08-02 04:42:33 +00:00
|
|
|
-}
|
|
|
|
|
2015-05-10 20:38:49 +00:00
|
|
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
|
|
|
|
2013-04-23 15:38:52 +00:00
|
|
|
module Config.Files where
|
2012-08-02 04:42:33 +00:00
|
|
|
|
|
|
|
import Utility.FreeDesktop
|
2020-10-29 16:02:46 +00:00
|
|
|
import Utility.Exception
|
|
|
|
|
|
|
|
import System.FilePath
|
2012-08-02 04:42:33 +00:00
|
|
|
|
|
|
|
{- ~/.config/git-annex/file -}
|
|
|
|
userConfigFile :: FilePath -> IO FilePath
|
|
|
|
userConfigFile file = do
|
|
|
|
dir <- userConfigDir
|
|
|
|
return $ dir </> "git-annex" </> file
|
|
|
|
|
|
|
|
autoStartFile :: IO FilePath
|
|
|
|
autoStartFile = userConfigFile "autostart"
|
|
|
|
|
2019-03-18 16:33:56 +00:00
|
|
|
{- The path to git-annex is written here; which is useful when something
|
2013-05-20 21:42:40 +00:00
|
|
|
- has installed it to some awful non-PATH location. -}
|
2012-08-02 04:42:33 +00:00
|
|
|
programFile :: IO FilePath
|
|
|
|
programFile = userConfigFile "program"
|
2012-08-27 17:43:03 +00:00
|
|
|
|
2019-02-05 18:43:23 +00:00
|
|
|
{- A .noannex file in a git repository prevents git-annex from
|
2020-12-14 16:32:21 +00:00
|
|
|
- initializing that repository. The content of the file is returned. -}
|
2019-02-08 17:16:10 +00:00
|
|
|
noAnnexFileContent :: Maybe FilePath -> IO (Maybe String)
|
|
|
|
noAnnexFileContent repoworktree = case repoworktree of
|
2019-02-05 18:43:23 +00:00
|
|
|
Nothing -> return Nothing
|
|
|
|
Just wt -> catchMaybeIO (readFile (wt </> ".noannex"))
|