web: fix loss of file path when reloading the journal
This commit is contained in:
parent
bf5ee88a30
commit
a8d86fb5e5
@ -59,16 +59,17 @@ myJournal = myLedgerPath >>= readJournal
|
|||||||
myTimelog :: IO Journal
|
myTimelog :: IO Journal
|
||||||
myTimelog = myTimelogPath >>= readJournal
|
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 :: FilePath -> IO Journal
|
||||||
readJournal f = do
|
readJournal f = do
|
||||||
s <- readFile f
|
s <- readFile f
|
||||||
journalFromString s
|
j <- journalFromString s
|
||||||
|
return j{filepath=f}
|
||||||
|
|
||||||
-- | Read a Journal from the given string, using the current time as
|
-- | Read a Journal from the given string, using the current time as
|
||||||
-- reference time, or throw an error.
|
-- reference time, or throw an error.
|
||||||
journalFromString :: String -> IO Journal
|
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).
|
-- -- | Expand ~ in a file path (does not handle ~name).
|
||||||
-- tildeExpand :: FilePath -> IO FilePath
|
-- tildeExpand :: FilePath -> IO FilePath
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user