Skip to content

Commit 636be05

Browse files
committed
Fix "invalid characters" bug on Windows
We now use `fsPath` instead of `path`. Note: I haven't yet fixed the tests, nor checked manually on mac/linux Tangential change: we now use the `dirname` method, instead of manually splitting paths to get a parent folder.
1 parent 3087886 commit 636be05

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

extensions/ql-vscode/src/skeleton-query-wizard.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from "path";
1+
import { join, dirname } from "path";
22
import { CancellationToken, Uri, workspace, window as Window } from "vscode";
33
import { CodeQLCliServer } from "./cli";
44
import { OutputChannelLogger } from "./common";
@@ -103,15 +103,11 @@ export class SkeletonQueryWizard {
103103
// For the vscode-codeql-starter repo, the first folder will be a ql pack
104104
// so we need to get the parent folder
105105
if (firstFolder.uri.path.includes("codeql-custom-queries")) {
106-
// slice off the last part of the path and return the parent folder
107-
if (process.platform === "win32") {
108-
return firstFolder.uri.path.split("\\").slice(0, -1).join("\\");
109-
} else {
110-
return firstFolder.uri.path.split("/").slice(0, -1).join("/");
111-
}
106+
// return the parent folder
107+
return dirname(firstFolder.uri.fsPath);
112108
} else {
113109
// if the first folder is not a ql pack, then we are in a normal workspace
114-
return firstFolder.uri.path;
110+
return firstFolder.uri.fsPath;
115111
}
116112
}
117113

0 commit comments

Comments
 (0)