|
|
|
@ -360,11 +360,8 @@ class FileManager extends Plugin { |
|
|
|
|
async remove (path) { |
|
|
|
|
try { |
|
|
|
|
path = this.limitPluginScope(path) |
|
|
|
|
console.log('remove fileManager,js ', path) |
|
|
|
|
await this._handleExists(path, `Cannot remove file or directory ${path}`) |
|
|
|
|
const provider = this.fileProviderOf(path) |
|
|
|
|
|
|
|
|
|
// this.emit('folderRemoved', path)
|
|
|
|
|
return await provider.remove(path) |
|
|
|
|
} catch (e) { |
|
|
|
|
throw new Error(e) |
|
|
|
@ -385,7 +382,6 @@ class FileManager extends Plugin { |
|
|
|
|
this._deps.browserExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) }) |
|
|
|
|
this._deps.browserExplorer.event.on('fileAdded', (path) => { this.fileAddedEvent(path) }) |
|
|
|
|
this._deps.localhostExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) }) |
|
|
|
|
this._deps.localhostExplorer.event.on('folderRemoved', (path) => { this.removeTabsOfPath(path) }) |
|
|
|
|
this._deps.localhostExplorer.event.on('errored', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) |
|
|
|
|
this._deps.localhostExplorer.event.on('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) |
|
|
|
|
this._deps.workspaceExplorer.event.on('fileChanged', (path) => { this.fileChangedEvent(path) }) |
|
|
|
@ -550,19 +546,6 @@ class FileManager extends Plugin { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
removeTabsOfPath (path) { |
|
|
|
|
for (const tab in this.openedFiles) { |
|
|
|
|
if (tab.substring(0, path.length) === path) { |
|
|
|
|
console.log('removeTabsOfPath ', path) |
|
|
|
|
if (path === this._deps.config.get('currentFile')) { |
|
|
|
|
this._deps.config.set('currentFile', '') |
|
|
|
|
} |
|
|
|
|
this.editor.discard(path) |
|
|
|
|
delete this.openedFiles[path] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fileRemovedEvent (path) { |
|
|
|
|
if (path === this._deps.config.get('currentFile')) { |
|
|
|
|
this._deps.config.set('currentFile', '') |
|
|
|
|