Skip to content

Commit d2b69b1

Browse files
Normalize tmp path to ensure correct comparrison on windows
1 parent a30ec90 commit d2b69b1

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/ql-vscode/src/pure/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function getDirectoryNamesInsidePath(
5151
return dirNames;
5252
}
5353

54-
function normalizePath(path: string): string {
54+
export function normalizePath(path: string): string {
5555
// On Windows, "C:/", "C:\", and "c:/" are all equivalent. We need
5656
// to normalize the paths to ensure they all get resolved to the
5757
// same format. On Windows, we also need to do the comparison

extensions/ql-vscode/test/vscode-tests/minimal-workspace/common/vscode/file-path-discovery.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { FilePathDiscovery } from "../../../../../src/common/vscode/file-path-di
1010
import { basename, dirname, join } from "path";
1111
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
1212
import * as tmp from "tmp";
13+
import { normalizePath } from "../../../../../src/pure/files";
1314

1415
interface TestData {
1516
path: string;
@@ -75,7 +76,7 @@ describe("FilePathDiscovery", () => {
7576

7677
beforeEach(() => {
7778
const t = tmp.dirSync();
78-
tmpDir = t.name;
79+
tmpDir = normalizePath(t.name);
7980
tmpDirRemoveCallback = t.removeCallback;
8081

8182
workspaceFolder = {

0 commit comments

Comments
 (0)