Skip to content

Commit

Permalink
Revert "File Explorer: Fix issue with creating directory from file"
Browse files Browse the repository at this point in the history
This reverts commit 3f7b53c.
  • Loading branch information
tylersmalley committed Aug 3, 2023
1 parent 3f7b53c commit 407fd07
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/node-explorer-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,33 +272,25 @@ export class NodeExplorerProvider implements vscode.TreeDataProvider<PeerBaseTre
return;
}

let targetPath = resourcePath;

// TODO: validate input
const targetName = await vscode.window.showInputBox({
const dirName = await vscode.window.showInputBox({
prompt: 'Enter a name for the new directory',
placeHolder: 'New directory',
});

if (!targetName) {
if (!dirName) {
return;
}

if (node.type !== vscode.FileType.Directory) {
targetPath = path.dirname(resourcePath);
}

const newUri = createTsUri({
tailnet,
address,
resourcePath: `${targetPath}/${targetName}`,
resourcePath: `${resourcePath}/${dirName}`,
});

try {
await vscode.workspace.fs.createDirectory(newUri);
this._onDidChangeTreeData.fire([
node.type !== vscode.FileType.Directory ? undefined : node,
]);
this._onDidChangeTreeData.fire([node]);
} catch (e) {
vscode.window.showErrorMessage(`Could not create directory: ${e}`);
}
Expand Down

0 comments on commit 407fd07

Please sign in to comment.