Skip to content
Snippets Groups Projects
Commit 186d448f authored by Patrick Augusto's avatar Patrick Augusto
Browse files

Changing to canonicalizePathNoThrow to prevent exceptions

parent 5892f423
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ guessLanguage = do
-- | Guess the package name based on the given root directory.
guessPackageName :: Interactive m => FilePath -> m PackageName
guessPackageName = fmap (mkPackageName . repair . fromMaybe "" . safeLast . splitDirectories)
. tryCanonicalizePath
. canonicalizePathNoThrow
where
-- Treat each span of non-alphanumeric characters as a hyphen. Each
-- hyphenated component of a package name must contain at least one
......
......@@ -301,7 +301,7 @@ class Monad m => Interactive m where
listDirectory :: FilePath -> m [FilePath]
doesDirectoryExist :: FilePath -> m Bool
doesFileExist :: FilePath -> m Bool
tryCanonicalizePath :: FilePath -> m FilePath
canonicalizePathNoThrow :: FilePath -> m FilePath
readProcessWithExitCode :: FilePath -> [String] -> String -> m (ExitCode, String, String)
getEnvironment :: m [(String, String)]
listFilesInside :: (FilePath -> m Bool) -> FilePath -> m [FilePath]
......@@ -329,7 +329,7 @@ instance Interactive IO where
listDirectory = P.listDirectory
doesDirectoryExist = P.doesDirectoryExist
doesFileExist = P.doesFileExist
tryCanonicalizePath = P.tryCanonicalizePath
canonicalizePathNoThrow = P.canonicalizePathNoThrow
readProcessWithExitCode = P.readProcessWithExitCode
getEnvironment = P.getEnvironment
listFilesInside = P.listFilesInside
......@@ -356,7 +356,7 @@ instance Interactive PurePrompt where
listDirectory !_ = popList
doesDirectoryExist !_ = popBool
doesFileExist !_ = popBool
tryCanonicalizePath !_ = popAbsolute
canonicalizePathNoThrow !_ = popAbsolute
readProcessWithExitCode !_ !_ !_ = do
input <- pop
return (ExitSuccess, input, "")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment