function cs_cache_class:initialize()
self._csdict = nil
- self._projectroot = nil
self._csfile = ".e2/hashcache"
end
return false
end
-
hce = self._csdict[filename]
assert(hce)
return
end
- if not self._projectroot then
- local info
-
- info = e2tool.info()
- if not info then
- return
- else
- self._projectroot = info.root
- end
- end
-
e2lib.register_cleanup("cs_cache_class:store_cache",
cs_cache_class.store_cache, self)
- chunk, msg = loadfile(e2lib.join(self._projectroot, self._csfile))
+ chunk, msg = loadfile(e2lib.join(e2tool.root(), self._csfile))
if not chunk then
e2lib.logf(3, "could not load cs_cache: %s", msg)
return
--- Store the checksum cache to disk.
-- Called by cleanup handler.
function cs_cache_class:store_cache()
- local hcachevec, out
+ local hcachevec, out, root
+
+ root = e2lib.locate_project_root()
- if not self._csdict or not self._projectroot then
+ if not self._csdict or not root then
return
end
end
table.insert(out, "}\n")
- eio.file_write(e2lib.join(self._projectroot, self._csfile), table.concat(out))
+ eio.file_write(e2lib.join(root, self._csfile), table.concat(out))
end
if not cscache then