fall back to homepath if home unset.

closes #112775
This commit is contained in:
Jackson Kearl 2021-01-12 15:43:57 -08:00
parent b3d57e69b0
commit 6184addcd1

View file

@ -128,16 +128,15 @@ export function activate(context: vscode.ExtensionContext) {
function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | undefined {
const homePath = process.env.HOME || process.env.HOMEPATH || '';
const scheme = homePath ? 'file' : 'vscode-userdata';
if (pathUtils.isAbsolute(path)) {
return vscode.Uri
.file(path)
.with({ scheme: process.env.HOME ? 'file' : 'vscode-userdata' });
return vscode.Uri.file(path).with({ scheme });
}
if (path.indexOf('~/') === 0) {
return vscode.Uri
.file(pathUtils.join(process.env.HOME ?? '', path.slice(2)))
.with({ scheme: process.env.HOME ? 'file' : 'vscode-userdata' });
return vscode.Uri.file(pathUtils.join(homePath, path.slice(2))).with({ scheme });
}
const uriFromFolderWithPath = (folder: vscode.WorkspaceFolder, path: string): vscode.Uri =>