Skip to content

Commit

Permalink
File Explorer: Fix issue with deleting a file (#171)
Browse files Browse the repository at this point in the history
When I updated the logic to support recursive deletes for directories, I
accidently broke single file deletes.

Signed-off-by: Tyler Smalley <tyler@tailscale.com>
  • Loading branch information
tylersmalley committed Aug 4, 2023
1 parent 717cc79 commit 38f9101
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/filesystem-provider-sftp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export class FileSystemProviderSFTP implements vscode.FileSystemProvider {
const { resourcePath, sftp } = await this.getParsedUriAndSftp(uri);

const deleteRecursively = async (path: string) => {
const st = await sftp.stat(path);

// short circuit for files
if (st.type === vscode.FileType.File) {
await sftp.delete(path);
return;
}

const files = await sftp.readDirectory(path);

for (const [file, fileType] of files) {
Expand Down

0 comments on commit 38f9101

Please sign in to comment.