diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2015-04-02 21:52:58 +0900 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2015-04-02 21:52:58 +0900 |
commit | bbbf74a5604d62e0be8af85cdc2bff217daf628a (patch) | |
tree | c359ca2f140c41ebf5a0a87505aa397f5328003d | |
parent | 821539f275da71d60da580f15bb886417c630209 (diff) | |
download | srem-bbbf74a5604d62e0be8af85cdc2bff217daf628a.tar.gz |
event cache dir should be created if missing
-rw-r--r-- | src/Utility/EventCache.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Utility/EventCache.hs b/src/Utility/EventCache.hs index efda675..aecaeaf 100644 --- a/src/Utility/EventCache.hs +++ b/src/Utility/EventCache.hs @@ -36,8 +36,8 @@ import Data.List.Split (splitOn, splitOneOf) import Data.Maybe.Read import Data.Time.Calendar import Data.Time.LocalTime -import System.Directory (doesFileExist, getDirectoryContents, - removeFile) +import System.Directory (createDirectoryIfMissing, doesFileExist, + getDirectoryContents, removeFile) import System.FilePath ((</>)) import Types.Reminder import Utility.Emacs @@ -58,6 +58,7 @@ purgeOldEventCaches = do appendManualEventCache :: Reminder -> Day -> IO () appendManualEventCache r d = do dir <- SremConfig.getCacheDirectory + createDirectoryIfMissing True dir let path = dir </> "manual_" ++ (showGregorian d) ++ ".csv" appendFile path $ makeEventsCSV [r] @@ -73,6 +74,7 @@ readEmacsEventCache :: IO [Reminder] readEmacsEventCache = do date <- todaysCacheFileDateString dir <- SremConfig.getCacheDirectory + createDirectoryIfMissing True dir let path = dir </> "emacs_" ++ date ++ ".csv" doesFileExist path >>= \alreadyThere -> if alreadyThere |