Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 085ec81

Browse files
author
Max Schmidt
committed
Merge remote-tracking branch 'origin/revert-6-dev' into dev
2 parents c0029d5 + 420f5b1 commit 085ec81

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

lib/storage.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class Storage {
1212
constructor(state) {
1313
if(state !== undefined && state !== null && typeof state === 'object') {
1414
if(state.dir !== undefined && state.dir !== null && typeof state.dir === 'string') {
15-
this.init(state.dir);
15+
this.init(state.dir.split('/').join('\\'));
1616
}
1717
}
1818
}
@@ -28,19 +28,12 @@ export default class Storage {
2828
destroy() {}
2929

3030
init(directory) {
31-
var temp = '\\';
32-
var store = this.storageDir;
33-
directory.split('/').join('\\').split('\\').forEach(function(currentValue,index) {
34-
if(currentValue !== "" && currentValue !== " " && currentValue !== null && currentValue !== undefined) {
35-
temp += currentValue+'\\';
36-
try {
37-
fs.statSync(store+temp);
38-
} catch(e) {
39-
fs.mkdirSync(store+temp);
40-
}
41-
}
42-
});
43-
this.dir = temp;
31+
this.dir = directory;
32+
try {
33+
fs.statSync(this.storageDir+this.dir);
34+
} catch(e) {
35+
fs.mkdirSync(this.storageDir+this.dir);
36+
}
4437
}
4538

4639
store(snippet) {

0 commit comments

Comments
 (0)