mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
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 = 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
|
||||
|
Loading…
Reference in New Issue
Block a user