mirror of https://github.com/keeweb/keeweb.git
Fixed callbacks in mkdir and initFs
This commit is contained in:
parent
bda4cbf2ad
commit
cd2f53b525
|
@ -103,18 +103,12 @@ const Launcher = {
|
|||
|
||||
const create = function(stack, callback) {
|
||||
if (!stack.length) {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
fs.mkdir(stack.shift(), err => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
create(stack, callback);
|
||||
});
|
||||
fs.mkdir(stack.shift(), err =>
|
||||
err ? callback(err) : create(stack, callback)
|
||||
);
|
||||
};
|
||||
|
||||
collect(dir, stack, () => create(stack, callback));
|
||||
|
|
|
@ -21,16 +21,16 @@ const StorageFileCache = StorageBase.extend({
|
|||
|
||||
const path = Launcher.getUserDataPath('OfflineFiles');
|
||||
|
||||
const setPath = (err) => {
|
||||
this.path = err ? null : path;
|
||||
return callback && callback(err);
|
||||
};
|
||||
|
||||
Launcher.fileExists(path, exists => {
|
||||
if (!exists) {
|
||||
Launcher.mkdir(path, err => {
|
||||
if (!err) {
|
||||
this.path = path;
|
||||
}
|
||||
if (callback) { callback(); }
|
||||
});
|
||||
if (exists) {
|
||||
setPath();
|
||||
} else {
|
||||
if (callback) { callback(); }
|
||||
Launcher.mkdir(path, setPath());
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue