From 6b98ff92650580253d4b654cb394c1ca0af4cdd4 Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Tue, 19 Sep 2023 17:20:20 -0400 Subject: [PATCH 1/2] Node Explorer: accept subdirectories of ~ for root directory Signed-off-by: Naman Sood --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 3d1b805..ac1daee 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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; } From 653466f5b5854c9c6258a56117b2f869e62817c6 Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Wed, 20 Sep 2023 09:47:45 -0400 Subject: [PATCH 2/2] expand tilde in rootDir Signed-off-by: Naman Sood --- src/node-explorer-provider.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node-explorer-provider.ts b/src/node-explorer-provider.ts index 98972b2..67cc8f3 100644 --- a/src/node-explorer-provider.ts +++ b/src/node-explorer-provider.ts @@ -96,6 +96,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;