1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-13 04:15:47 +01:00

Make info directory before attempting to save files there.

This commit is contained in:
Kris Maglione
2014-03-01 18:06:10 -08:00
parent fb976055c7
commit 9653c379e4
3 changed files with 16 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
defineModule("storage", {
exports: ["File", "Storage", "storage"],
require: ["services", "util"]
require: ["promises", "services", "util"]
});
lazyRequire("config", ["config"]);
@@ -227,16 +227,18 @@ var Storage = Module("Storage", {
}
},
_saveData: function saveData(obj) {
_saveData: promises.task(function saveData(obj) {
if (obj.privateData && storage.privateMode)
return;
if (obj.store && storage.infoPath) {
var { path } = storage.infoPath.child(obj.name);
return OS.File.writeAtomic(
yield OS.File.makeDir(storage.infoPath.path,
{ ignoreExisting: true });
yield OS.File.writeAtomic(
path, obj.serial,
{ tmpPath: path + ".part" });
}
},
}),
storeForSession: function storeForSession(key, val) {
if (val)