Skip to content

Commit fde4622

Browse files
committed
(bluefox) create backups directory if not exists
1 parent ce2484d commit fde4622

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/setup/setupBackup.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ function BackupRestore(options) {
1111

1212
options = options || {};
1313

14-
if (!options.states) throw "Invalid arguments: states is missing";
15-
if (!options.objects) throw "Invalid arguments: objects is missing";
16-
if (!options.processExit) throw "Invalid arguments: processExit is missing";
17-
if (!options.cleanDatabase) throw "Invalid arguments: cleanDatabase is missing";
18-
if (!options.restartController) throw "Invalid arguments: restartController is missing";
14+
if (!options.states) throw 'Invalid arguments: states is missing';
15+
if (!options.objects) throw 'Invalid arguments: objects is missing';
16+
if (!options.processExit) throw 'Invalid arguments: processExit is missing';
17+
if (!options.cleanDatabase) throw 'Invalid arguments: cleanDatabase is missing';
18+
if (!options.restartController) throw 'Invalid arguments: restartController is missing';
1919

2020
var objects = options.objects;
2121
var states = options.states;
@@ -96,9 +96,14 @@ function BackupRestore(options) {
9696
}
9797

9898
name = name.replace(/\\/g, '/');
99-
if (name.indexOf('/') == -1) {
99+
if (name.indexOf('/') === -1) {
100100
var path = getBackupDir();
101101

102+
// create directory if not exists
103+
if (!fs.existsSync(path)) {
104+
fs.mkdirSync(path);
105+
}
106+
102107
if (name.indexOf('.tar.gz') == -1) {
103108
name = path + name + '.tar.gz';
104109
} else {

0 commit comments

Comments
 (0)