expand ~ paths in readLedger

This commit is contained in:
Simon Michael 2009-05-16 21:10:41 +00:00
parent ef39cced4a
commit d3dcd29957

View File

@ -38,12 +38,12 @@ noioargs = (DateSpan Nothing Nothing, Nothing, False, False, [], [])
-- | Get the user's default ledger file path. -- | Get the user's default ledger file path.
myLedgerPath :: IO String myLedgerPath :: IO String
myLedgerPath = myLedgerPath =
getEnv ledgerenvvar `catch` \_ -> return ledgerdefaultpath >>= tildeExpand getEnv ledgerenvvar `catch` \_ -> return ledgerdefaultpath
-- | Get the user's default timelog file path. -- | Get the user's default timelog file path.
myTimelogPath :: IO String myTimelogPath :: IO String
myTimelogPath = myTimelogPath =
getEnv timelogenvvar `catch` \_ -> return timelogdefaultpath >>= tildeExpand getEnv timelogenvvar `catch` \_ -> return timelogdefaultpath
-- | Read the user's default ledger file, or give an error. -- | Read the user's default ledger file, or give an error.
myLedger :: IO Ledger myLedger :: IO Ledger
@ -55,7 +55,7 @@ myTimelog = myTimelogPath >>= readLedger
-- | Read a ledger from this file, with no filtering, or give an error. -- | Read a ledger from this file, with no filtering, or give an error.
readLedger :: FilePath -> IO Ledger readLedger :: FilePath -> IO Ledger
readLedger = readLedgerWithIOArgs noioargs readLedger f = tildeExpand f >>= readLedgerWithIOArgs noioargs
-- | Read a ledger from this file, filtering according to the io args, -- | Read a ledger from this file, filtering according to the io args,
-- | or give an error. -- | or give an error.