diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 0249ab783a..ec9f86b614 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -207,13 +207,13 @@ function fileExplorer (localRegistry, files, menuItems) { } } else { actions['Rename'] = () => { - if (self.files.readonly) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') } + if (self.files.isReadOnly(key)) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') } var name = label.querySelector('span[data-path="' + key + '"]') if (name) editModeOn(name) } } actions['Delete'] = () => { - if (self.files.readonly) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') } + if (self.files.isReadOnly(key)) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') } modalDialogCustom.confirm('Confirm to delete a folder', 'Are you sure you want to delete this folder?', () => { files.remove(key) }, () => {}) } MENU_HANDLE = contextMenu(event, actions) @@ -226,12 +226,12 @@ function fileExplorer (localRegistry, files, menuItems) { const provider = self._deps.fileManager.fileProviderOf(key) if (!provider.isExternalFolder(key)) { actions['Rename'] = () => { - if (self.files.readonly) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') } + if (self.files.isReadOnly(key)) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') } var name = label.querySelector('span[data-path="' + key + '"]') if (name) editModeOn(name) } actions['Delete'] = () => { - if (self.files.readonly) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') } + if (self.files.isReadOnly(key)) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') } modalDialogCustom.confirm( 'Delete a file', 'Are you sure you want to delete this file?', () => { files.remove(key) }, diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index 29cc29cfd6..ca741075ed 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -71,7 +71,7 @@ class FileProvider { get (path, cb) { cb = cb || function () {} - if (this.normalizedNameExists[path]) path = this.getNormalizedName(path) // ensure we actually use the normalized path from here + if (this.normalizedNameExists(path)) path = this.getNormalizedName(path) // ensure we actually use the normalized path from here var unprefixedpath = this.removePrefix(path) var exists = window.remixFileSystem.existsSync(unprefixedpath) if (!exists) return cb(null, null) diff --git a/src/app/files/remixDProvider.js b/src/app/files/remixDProvider.js index 796ac09a53..bbf9ce68a1 100644 --- a/src/app/files/remixDProvider.js +++ b/src/app/files/remixDProvider.js @@ -113,10 +113,6 @@ module.exports = class RemixDProvider { return true } - addReadOnly (path, content) { - return false - } - isReadOnly (path) { return this._readOnlyMode || this._readOnlyFiles[path] === 1 }