From a8d86fb5e5559a1cf70f16fcbe19d6717741d162 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 23 May 2010 22:24:30 +0000 Subject: [PATCH] web: fix loss of file path when reloading the journal --- hledger-lib/Hledger/Data/IO.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hledger-lib/Hledger/Data/IO.hs b/hledger-lib/Hledger/Data/IO.hs index ce8ccb7c7..035420c20 100644 --- a/hledger-lib/Hledger/Data/IO.hs +++ b/hledger-lib/Hledger/Data/IO.hs @@ -59,16 +59,17 @@ myJournal = myLedgerPath >>= readJournal myTimelog :: IO Journal myTimelog = myTimelogPath >>= readJournal --- | Read a journal from this file, or give an error. +-- | Read a journal from this file, or throw an error. readJournal :: FilePath -> IO Journal readJournal f = do s <- readFile f - journalFromString s + j <- journalFromString s + return j{filepath=f} -- | Read a Journal from the given string, using the current time as -- reference time, or throw an error. journalFromString :: String -> IO Journal -journalFromString s = liftM (either error id) $ runErrorT $ parseJournal "(string)" s +journalFromString s = liftM (either error id) $ runErrorT $ parseJournal "(from string)" s -- -- | Expand ~ in a file path (does not handle ~name). -- tildeExpand :: FilePath -> IO FilePath