make getPath return undefined when there is not just one root, #28526

This commit is contained in:
Johannes Rieken
2017-06-21 10:58:01 +02:00
parent 88230f5d32
commit 919d3feca4
2 changed files with 27 additions and 1 deletions

View File

@@ -43,7 +43,16 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
// this is legacy from the days before having
// multi-root and we keep it only alive if there
// is just one workspace folder.
return this._workspace ? this._workspace.roots[0].fsPath : undefined;
if (!this._workspace) {
return undefined;
}
const { roots } = this._workspace;
if (roots.length === 1) {
return roots[0].fsPath;
}
// return `undefined` when there no or more than 1
// root folder.
return undefined;
}
getRelativePath(pathOrUri: string | vscode.Uri): string {