mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 14:01:38 +01:00
Make fixPathPrefixes a bit more resiliant
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as arrays from './arrays';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
|
||||
export enum TsServerLogLevel {
|
||||
Off,
|
||||
@@ -85,11 +86,10 @@ export class TypeScriptServiceConfiguration {
|
||||
}
|
||||
|
||||
private static fixPathPrefixes(inspectValue: string): string {
|
||||
const pathPrefixes = ['~/'];
|
||||
const pathPrefixes = ['~' + path.sep];
|
||||
for (const pathPrefix of pathPrefixes) {
|
||||
if (inspectValue.startsWith(pathPrefix)) {
|
||||
const homedir = os.homedir().concat('/');
|
||||
return inspectValue.replace(pathPrefix, homedir);
|
||||
return path.join(os.homedir(), inspectValue.slice(pathPrefix.length));
|
||||
}
|
||||
}
|
||||
return inspectValue;
|
||||
|
||||
Reference in New Issue
Block a user