Skip to content

Commit

Permalink
Node Explorer: accept subdirectories of ~ for root directory (#230)
Browse files Browse the repository at this point in the history
Fixes #200.

---------

Signed-off-by: Naman Sood <[email protected]>
  • Loading branch information
tendstofortytwo authored Sep 21, 2023
1 parent a7acda2 commit 51b4042
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export async function activate(context: vscode.ExtensionContext) {
return;
}

if (!path.isAbsolute(dir) && dir !== '~') {
if (!path.isAbsolute(dir) && dir !== '~' && !dir.startsWith('~/')) {
vscode.window.showErrorMessage(`${dir} is an invalid absolute path`);
return;
}
Expand Down
3 changes: 3 additions & 0 deletions src/node-explorer-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export class NodeExplorerProvider
const homeDir = await this.fsProvider.getHomeDirectory(element.Address);

if (rootDir && rootDir !== '~') {
if (rootDir.startsWith('~/')) {
rootDir = `${homeDir}/${rootDir.slice(2)}`;
}
dirDesc = trimPathPrefix(rootDir, homeDir);
} else {
rootDir = homeDir;
Expand Down

0 comments on commit 51b4042

Please sign in to comment.