cli: give a non-confusing error when literal tilde found in LEDGER_FILE

This commit is contained in:
Simon Michael 2011-09-21 22:58:47 +00:00
parent 6019c932fb
commit f5eecc34a3

View File

@ -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 =