Skip to content

Commit

Permalink
create default folder
Browse files Browse the repository at this point in the history
  • Loading branch information
liweitian committed Nov 11, 2019
1 parent d757225 commit 620d3fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Composer/packages/server/src/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class StorageService {
constructor() {
this.storageConnections = Store.get(this.STORE_KEY);
this.storageConnections.forEach(s => {
if (!fs.existsSync(s.defaultPath)) {
fs.mkdirSync(s.defaultPath);
}
this.createFolderRecurively(s.defaultPath);
});
}

Expand Down Expand Up @@ -134,6 +132,13 @@ class StorageService {
const result = await Promise.all(children);
return result.filter(item => !!item);
};

private createFolderRecurively = (path: string) => {
if (!fs.existsSync(path)) {
this.createFolderRecurively(Path.dirname(path));
fs.mkdirSync(path);
}
};
}

const service = new StorageService();
Expand Down

0 comments on commit 620d3fb

Please sign in to comment.