;imp:lib:Hledger.Utils.IO.expandHomePath: handle a bare ~
This commit is contained in:
parent
de900e5b24
commit
60293349bb
@ -401,6 +401,7 @@ getHomeSafe = fmap Just getHomeDirectory `catch` (\(_ :: IOException) -> return
|
||||
-- ~username is not supported. Can raise an error.
|
||||
expandHomePath :: FilePath -> IO FilePath
|
||||
expandHomePath = \case
|
||||
"~" -> getHomeDirectory
|
||||
('~':'/':p) -> (</> p) <$> getHomeDirectory
|
||||
('~':'\\':p) -> (</> p) <$> getHomeDirectory
|
||||
('~':_) -> ioError $ userError "~USERNAME in paths is not supported"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user