Fix export results default save location (#18224)

* Fix export results default save location

* cleanup
This commit is contained in:
Charles Gagnon
2022-02-04 16:20:10 -08:00
committed by GitHub
parent d9967cf527
commit 6c8e2bf8f3
2 changed files with 13 additions and 14 deletions

View File

@@ -9,14 +9,12 @@ import { URI } from 'vs/base/common/uri';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
export const FILE_SCHEMA: string = 'file';
export function resolveCurrentDirectory(uri: string, rootPath?: string): string | undefined {
let sqlUri = URI.parse(uri);
let currentDirectory: string | undefined;
// use current directory of the sql file if sql file is saved
if (sqlUri.scheme === FILE_SCHEMA) {
if (sqlUri.scheme === Schemas.file) {
currentDirectory = dirname(sqlUri.fsPath);
} else if (sqlUri.scheme === Schemas.untitled) {
// if sql file is unsaved/untitled but a workspace is open use workspace root