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

Commit f198618

Browse files
author
Max Schmidt
committed
FIX: Storage init
1 parent 5aea6cf commit f198618

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/storage.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ export default class Storage {
2828
destroy() {}
2929

3030
init(directory) {
31-
this.dir = directory;
32-
try {
33-
fs.statSync(this.storageDir+this.dir);
34-
} catch(e) {
35-
fs.mkdirSync(this.storageDir+this.dir);
36-
}
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;
3744
}
3845

3946
store(snippet) {

0 commit comments

Comments
 (0)