Skip to content
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

Fixing bugs of FE #2386 #2427

Merged
merged 7 commits into from
Nov 12, 2019
Merged

Fixing bugs of FE #2386 #2427

merged 7 commits into from
Nov 12, 2019

Conversation

LianaHus
Copy link
Collaborator

@LianaHus LianaHus commented Nov 8, 2019

No description provided.

@LianaHus LianaHus changed the title unique name for create file WIP unique name for create file and delete folder Nov 8, 2019
@LianaHus LianaHus changed the title WIP unique name for create file and delete folder Fixing bugs of FE #2386 Nov 12, 2019
if (error) return modalDialogCustom.alert('Failed to create file ' + newName + ' ' + error)
const currentPath = !parentFolder ? self._deps.fileManager.currentPath() : parentFolder
newName = currentPath ? currentPath + '/' + newName : self.files.type + '/' + newName
if (input === '') input = 'New file'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather do if (input) like that you check for null & undefined also.

@@ -601,14 +605,24 @@ fileExplorer.prototype.createNewFile = function (parentFolder) {

fileExplorer.prototype.createNewFolder = function (parentFolder) {
let self = this
modalDialogCustom.prompt('Create new folder', '', '', (input) => {
modalDialogCustom.prompt('Create new folder', '', 'New folder', (input) => {
if (input === '') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

modalDialogCustom.prompt('Create new folder', '', 'New folder', (input) => {
if (input === '') {
tooltip('Failed to create folder. The name can not be empty')
return false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using return to stop the process of the scope I would rath do return tooltip(...). Returning false feels like it's used somewhere. If this is the case then forget this comment.

} else {
window.remixFileSystem.unlinkSync(unprefixedpath, console.log)
path = this.removePrefix(path)
if (window.remixFileSystem.existsSync(path)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What ??? We inject the FileSystem as a global value in the file system o.O"

this.event.trigger('fileRemoved', [this._normalizePath(path)])
return true
} else {
let items = window.remixFileSystem.readdirSync(path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not reassigning it. So you can use const

let items = window.remixFileSystem.readdirSync(path)
if (items.length !== 0) {
items.forEach((item, index) => {
let curPath = path + '/' + item
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe :

const currPath = `${path}/${item}`

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it is better?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't reassign it so you can you const.
Personally I find the ${a}divder${b} writing more readable than using concatenation (just suggesting here).

@LianaHus LianaHus merged commit 0c180e6 into master Nov 12, 2019
@LianaHus LianaHus deleted the deleteDir branch November 12, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants