cli: give a non-confusing error when literal tilde found in LEDGER_FILE
This commit is contained in:
parent
6019c932fb
commit
f5eecc34a3
@ -137,6 +137,7 @@ 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 ""))
|
||||
@ -144,6 +145,8 @@ myJournalPath = 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 =
|
||||
|
||||
Loading…
Reference in New Issue
Block a user