better directory handling
Rename Locations functions for better consitency, and make their values more consistent too. Used </> rather than manually building paths. There are still more places that manually do so, but are tricky, due to the behavior of </> when the second FilePath is absolute. So I only changed places where it obviously was relative.
This commit is contained in:
parent
6be516ae3b
commit
167523f09d
16 changed files with 78 additions and 57 deletions
|
@ -40,7 +40,7 @@ start s = do
|
|||
readUnusedLog :: Annex (M.Map String Key)
|
||||
readUnusedLog = do
|
||||
g <- Annex.gitRepo
|
||||
let f = annexUnusedLog g
|
||||
let f = gitAnnexUnusedLog g
|
||||
e <- liftIO $ doesFileExist f
|
||||
if e
|
||||
then do
|
||||
|
|
|
@ -10,6 +10,7 @@ module Command.Init where
|
|||
import Control.Monad.State (liftIO)
|
||||
import Control.Monad (when)
|
||||
import System.Directory
|
||||
import System.FilePath
|
||||
|
||||
import Command
|
||||
import qualified Annex
|
||||
|
@ -75,7 +76,7 @@ gitAttributesWrite repo = do
|
|||
attributes]
|
||||
|
||||
attrLine :: String
|
||||
attrLine = stateLoc ++ "*.log merge=union"
|
||||
attrLine = stateDir </> "*.log merge=union"
|
||||
|
||||
{- set up a git pre-commit hook, if one is not already present -}
|
||||
gitPreCommitHookWrite :: Git.Repo -> Annex ()
|
||||
|
|
|
@ -50,7 +50,7 @@ perform file oldkey newbackend = do
|
|||
-- (the file can't be stored as usual, because it's already a symlink).
|
||||
-- The old backend's key is not dropped from it, because there may
|
||||
-- be other files still pointing at that key.
|
||||
let src = annexLocation g oldkey
|
||||
let src = gitAnnexLocation g oldkey
|
||||
stored <- Backend.storeFileKey src $ Just newbackend
|
||||
case stored of
|
||||
Nothing -> return Nothing
|
||||
|
|
|
@ -32,7 +32,7 @@ start keyname = do
|
|||
let key = genKey (head backends) keyname
|
||||
present <- inAnnex key
|
||||
g <- Annex.gitRepo
|
||||
let file = annexLocation g key
|
||||
let file = gitAnnexLocation g key
|
||||
when present $
|
||||
liftIO $ rsyncServerSend file
|
||||
liftIO exitFailure
|
||||
|
|
|
@ -43,7 +43,7 @@ perform dest key = do
|
|||
error "content not present"
|
||||
|
||||
g <- Annex.gitRepo
|
||||
let src = annexLocation g key
|
||||
let src = gitAnnexLocation g key
|
||||
liftIO $ removeFile dest
|
||||
showNote "copying..."
|
||||
ok <- liftIO $ copyFile src dest
|
||||
|
|
|
@ -43,7 +43,7 @@ checkUnused = do
|
|||
unused <- unusedKeys
|
||||
let list = number 1 unused
|
||||
g <- Annex.gitRepo
|
||||
liftIO $ writeFile (annexUnusedLog g) $ unlines $
|
||||
liftIO $ writeFile (gitAnnexUnusedLog g) $ unlines $
|
||||
map (\(n, k) -> show n ++ " " ++ show k) list
|
||||
if null unused
|
||||
then return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue