From 60293349bb2bfb019bd1d63c0e0204eb0b932579 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 24 Dec 2025 17:12:24 -1000 Subject: [PATCH] ;imp:lib:Hledger.Utils.IO.expandHomePath: handle a bare ~ --- hledger-lib/Hledger/Utils/IO.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/hledger-lib/Hledger/Utils/IO.hs b/hledger-lib/Hledger/Utils/IO.hs index 2035b6648..986cb4b08 100644 --- a/hledger-lib/Hledger/Utils/IO.hs +++ b/hledger-lib/Hledger/Utils/IO.hs @@ -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"