-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update default bots folder #1548
Conversation
eee3744
to
620d3fb
Compare
@@ -18,6 +18,9 @@ class StorageService { | |||
|
|||
constructor() { | |||
this.storageConnections = Store.get(this.STORE_KEY); | |||
this.storageConnections.forEach(s => { | |||
this.createFolderRecurively(s.defaultPath); | |||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user has changed their default folder and then deleted the one we create? Won't this create /Documents/Composer every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default path is set in file data.template.json. It does not allow users to change it. These lines of code is to make sure the default path is always valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some questions about edge cases.
8044e2b
to
d0eb0b2
Compare
if (fs.existsSync(s.path)) { | ||
temp.path = Path.resolve(s.path); // resolve path if path is relative, and change it to unix pattern | ||
} else { | ||
this.createDefaultBotFolders(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are creating all folders inside a for loop. It's a O(n2) operation.
my suggestion is call this method "ensureFolderExisit", and put this after this map.
@liweitian there is a lint failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to address lint issue
c6468d5
to
eb0cde2
Compare
This reverts commit 8f2bc2e.
This reverts commit 8f2bc2e.
Description
Task Item
Closes #1506
Closes #1363
Type of change
Bug fix (non-breaking change which fixes an issue)