Use fsPath instead of path everywhere
This commit is contained in:
@@ -99,15 +99,16 @@ export class SkeletonQueryWizard {
|
||||
}
|
||||
|
||||
const firstFolder = workspaceFolders[0];
|
||||
const firstFolderFsPath = firstFolder.uri.fsPath;
|
||||
|
||||
// For the vscode-codeql-starter repo, the first folder will be a ql pack
|
||||
// so we need to get the parent folder
|
||||
if (firstFolder.uri.path.includes("codeql-custom-queries")) {
|
||||
if (firstFolderFsPath.includes("codeql-custom-queries")) {
|
||||
// return the parent folder
|
||||
return dirname(firstFolder.uri.fsPath);
|
||||
return dirname(firstFolderFsPath);
|
||||
} else {
|
||||
// if the first folder is not a ql pack, then we are in a normal workspace
|
||||
return firstFolder.uri.fsPath;
|
||||
return firstFolderFsPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,11 +83,11 @@ describe("SkeletonQueryWizard", () => {
|
||||
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
|
||||
{
|
||||
name: `codespaces-codeql`,
|
||||
uri: { path: storagePath },
|
||||
uri: { fsPath: storagePath },
|
||||
},
|
||||
{
|
||||
name: "/second/folder/path",
|
||||
uri: { path: storagePath },
|
||||
uri: { fsPath: storagePath },
|
||||
},
|
||||
] as WorkspaceFolder[]);
|
||||
|
||||
@@ -306,7 +306,7 @@ describe("SkeletonQueryWizard", () => {
|
||||
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
|
||||
{
|
||||
name: "codespaces-codeql",
|
||||
uri: { path: "codespaces-codeql" },
|
||||
uri: { fsPath: "codespaces-codeql" },
|
||||
},
|
||||
] as WorkspaceFolder[]);
|
||||
|
||||
@@ -327,11 +327,13 @@ describe("SkeletonQueryWizard", () => {
|
||||
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
|
||||
{
|
||||
name: "codeql-custom-queries-cpp",
|
||||
uri: { path: "vscode-codeql-starter/codeql-custom-queries-cpp" },
|
||||
uri: { fsPath: "vscode-codeql-starter/codeql-custom-queries-cpp" },
|
||||
},
|
||||
{
|
||||
name: "codeql-custom-queries-csharp",
|
||||
uri: { path: "vscode-codeql-starter/codeql-custom-queries-csharp" },
|
||||
uri: {
|
||||
fsPath: "vscode-codeql-starter/codeql-custom-queries-csharp",
|
||||
},
|
||||
},
|
||||
] as WorkspaceFolder[]);
|
||||
|
||||
@@ -369,7 +371,7 @@ describe("SkeletonQueryWizard", () => {
|
||||
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
|
||||
{
|
||||
name: "codespaces-codeql",
|
||||
uri: { path: "codespaces-codeql\\codeql-custom-queries-cpp" },
|
||||
uri: { fsPath: "codespaces-codeql\\codeql-custom-queries-cpp" },
|
||||
},
|
||||
] as WorkspaceFolder[]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user