Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "debug-certificate-manager",
"version": "0.0.5",
"version": "0.0.6",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/rushstack.git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,29 @@ export function activate(context: vscode.ExtensionContext): void {
resolvedWorkspaceStorePath = storePath;
} else if (storePath.startsWith('~')) {
let homeDir: string;

if (vscode.env.remoteName) {
homeDir = await runWorkspaceCommandAsync({
const markerPrefix: string = '<<<HOMEDIR_START>>>';
const markerSuffix: string = '<<<HOMEDIR_END>>>';
const output: string = await runWorkspaceCommandAsync({
terminalOptions: { name: 'debug-certificate-manager', hideFromUser: true },
commandLine: `node -p "require('os').homedir()"`,
// Wrapping the desired node output in markers to trim uninteresting shell output.
commandLine: `node -p "'${markerPrefix}' + require('os').homedir() + '${markerSuffix}'"`,
terminal
});
terminal.writeLine(`Running command to resolve home directory: ${output}`);

const startIndex: number = output.indexOf(markerPrefix);
const endIndex: number = output.indexOf(markerSuffix);
if (startIndex !== -1 && endIndex !== -1) {
homeDir = output.substring(startIndex + markerPrefix.length, endIndex).trim();
} else {
throw new Error('Failed to parse home directory from command output');
}
} else {
homeDir = require('os').homedir();
}

terminal.writeLine(`Resolved home directory: ${homeDir}`);
const homeDirUri: vscode.Uri = vscode.Uri.from({
scheme: workspaceUri.scheme,
Expand Down