summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2016-04-27 23:04:17 -0400
committerJames Crayne <jim.crayne@gmail.com>2016-04-27 23:04:17 -0400
commit15a96a1856d924eb3436bc37800dbc3de99e347b (patch)
treeaaa7db5353a191534c5dc6cff3c146e4d81ed8d9 /lib
parenta56c77318170c5b14031b335f3c98446460ec58e (diff)
nicer name for temporary transaction dirs
Diffstat (limited to 'lib')
-rw-r--r--lib/Kiki.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs
index 79868c9..4c9f98c 100644
--- a/lib/Kiki.hs
+++ b/lib/Kiki.hs
@@ -219,10 +219,14 @@ refreshCache rt rootdir = do
219 unslash ('/':xs) = xs 219 unslash ('/':xs) = xs
220 unslash xs = xs 220 unslash xs = xs
221 createDirectoryIfMissing True cachedir 221 createDirectoryIfMissing True cachedir
222 tmpdir <- createTempDirectory cachedir "transaction.dir" 222 tmpdir <- createTempDirectory cachedir ("transaction." ++ takeBaseName destdir)
223 createSymbolicLink tmpdir (tmpdir ++ ".link") 223 createSymbolicLink tmpdir (tmpdir ++ ".link")
224 let mkpath pth = tmpdir </> unslash pth 224 let mkpath pth = tmpdir </> unslash pth
225 commit = rename (tmpdir ++ ".link") destdir 225 commit = do
226 -- oldcommit <- readSymbolicLink destdir
227 rename (tmpdir ++ ".link") destdir
228 -- FIXME: somehow cleanup old commits
229 -- removeDirectoryRecursive oldcommit
226 return (mkpath,commit) 230 return (mkpath,commit)
227 (mkpath, commit) <- getMkPathAndCommit (fromMaybe "" rootdir ++ "/var/cache/kiki/config") 231 (mkpath, commit) <- getMkPathAndCommit (fromMaybe "" rootdir ++ "/var/cache/kiki/config")
228 232