Enable search editor in non-HOME envs

pull/107201/head^2
Jackson Kearl 2020-09-23 11:36:35 -07:00
parent e1b06c9a81
commit d4ae4a64ec
1 changed files with 9 additions and 2 deletions

View File

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