diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 92a263e67d695294235f0d539bf21c26d836fc37..f4f448a3abd051cfe6f6f47acf8d13465d5b2976 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -167,12 +167,13 @@ export interface IStat { export interface IFileSystemProvider { onDidChange?: Event; stat(resource: URI): TPromise; - readdir(resource: URI): TPromise; - mkdir(resource: URI): TPromise; read(resource: URI, progress: IProgress): TPromise; write(resource: URI, content: Uint8Array): TPromise; + unlink(resource: URI): TPromise; rename(resource: URI, target: URI): TPromise; - del(resource: URI): TPromise; + mkdir(resource: URI): TPromise; + readdir(resource: URI): TPromise; + rmdir(resource: URI): TPromise; } diff --git a/src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts b/src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts index 2867b30db593c63794868f070cc193b52ed90923..c22fe332520937396ee604db1a3e3f00fc0cb565 100644 --- a/src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts +++ b/src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts @@ -93,23 +93,18 @@ export class FtpFileSystemProvider implements IFileSystemProvider { return ninvoke(this._connection, this._connection.put, content, resource.path); } - del(resource: URI): TPromise { - - return ninvoke(this._connection, this._connection.ls, resource.path).then(entries => { - if (entries.length === 1) { - // file; - return ninvoke(this._connection, this._connection.raw, 'DELE', [resource.path]); - } else { - // dir - return ninvoke(this._connection, this._connection.raw, 'RMD', [resource.path]); - } - }); + rmdir(resource: URI): TPromise { + return ninvoke(this._connection, this._connection.raw, 'RMD', [resource.path]); } mkdir(resource: URI): TPromise { return ninvoke(this._connection, this._connection.raw, 'MKD', [resource.path]); } + unlink(resource: URI): TPromise { + return ninvoke(this._connection, this._connection.raw, 'DELE', [resource.path]); + } + rename(resource: URI, target: URI): TPromise { return ninvoke(this._connection, this._connection.raw, 'RNFR', [resource.path]).then(() => { return ninvoke(this._connection, this._connection.raw, 'RNTO', [target.path]); diff --git a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts index d2c1760963d4d263471c97f20fbf092e165ef145..009692840316beadf6fa3787913a5f0094670425 100644 --- a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts +++ b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts @@ -258,7 +258,8 @@ export class RemoteFileService extends FileService { async del(resource: URI, useTrash?: boolean): TPromise { const provider = this._provider.get(resource.scheme); if (provider) { - await provider.del(resource); + const stat = await provider.stat(resource); + await stat.type === FileType.Dir ? provider.rmdir(resource) : provider.unlink(resource); this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.DELETE)); } else { return super.del(resource, useTrash);