made parentDir return a Maybe FilePath; removed most uses of it
parentDir is less safe than takeDirectory, especially when working with relative FilePaths. It's really only useful in loops that want to terminate at / This commit was sponsored by Audric SCHILTKNECHT.
This commit is contained in:
parent
d09a198ec0
commit
965e106f24
47 changed files with 97 additions and 96 deletions
|
@ -83,7 +83,7 @@ checkRepositoryPath p = do
|
|||
home <- myHomeDir
|
||||
let basepath = expandTilde home $ T.unpack p
|
||||
path <- absPath basepath
|
||||
let parent = parentDir path
|
||||
let parent = takeDirectory path
|
||||
problems <- catMaybes <$> mapM runcheck
|
||||
[ (return $ path == "/", "Enter the full path to use for the repository.")
|
||||
, (return $ all isSpace basepath, "A blank path? Seems unlikely.")
|
||||
|
@ -416,7 +416,7 @@ startFullAssistant path repogroup setup = do
|
|||
canWrite :: FilePath -> IO Bool
|
||||
canWrite dir = do
|
||||
tocheck <- ifM (doesDirectoryExist dir)
|
||||
(return dir, return $ parentDir dir)
|
||||
(return dir, return $ takeDirectory dir)
|
||||
catchBoolIO $ fileAccess tocheck False True False
|
||||
|
||||
{- Gets the UUID of the git repo at a location, which may not exist, or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue