From f5eecc34a3911f0262bb75e33b6193d6db8272b3 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 21 Sep 2011 22:58:47 +0000 Subject: [PATCH] cli: give a non-confusing error when literal tilde found in LEDGER_FILE --- hledger-lib/Hledger/Read.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Read.hs b/hledger-lib/Hledger/Read.hs index a8750e725..944d0a188 100644 --- a/hledger-lib/Hledger/Read.hs +++ b/hledger-lib/Hledger/Read.hs @@ -137,13 +137,16 @@ readJournal format s = journalFromPathAndString format "(string)" s myJournalPath :: IO String myJournalPath = do s <- envJournalPath + errorIfContainsTilde s if null s then defaultJournalPath else return s where envJournalPath = getEnv journalenvvar `catch` (\_ -> getEnv journalenvvar2 `catch` (\_ -> return "")) defaultJournalPath = do home <- getHomeDirectory `catch` (\_ -> return "") return $ home journaldefaultfilename - + +errorIfContainsTilde s = when ('~' `elem` s) $ error' "unsupported literal ~ found in environment variable, please adjust" + -- | Get the user's default timelog file path. myTimelogPath :: IO String myTimelogPath =