Normalize tmp path to ensure correct comparrison on windows

This commit is contained in:
Robert
2023-06-19 14:13:09 +01:00
parent a30ec907d0
commit d2b69b1316
2 changed files with 3 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ export async function getDirectoryNamesInsidePath(
return dirNames;
}
function normalizePath(path: string): string {
export function normalizePath(path: string): string {
// On Windows, "C:/", "C:\", and "c:/" are all equivalent. We need
// to normalize the paths to ensure they all get resolved to the
// same format. On Windows, we also need to do the comparison

View File

@@ -10,6 +10,7 @@ import { FilePathDiscovery } from "../../../../../src/common/vscode/file-path-di
import { basename, dirname, join } from "path";
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
import * as tmp from "tmp";
import { normalizePath } from "../../../../../src/pure/files";
interface TestData {
path: string;
@@ -75,7 +76,7 @@ describe("FilePathDiscovery", () => {
beforeEach(() => {
const t = tmp.dirSync();
tmpDir = t.name;
tmpDir = normalizePath(t.name);
tmpDirRemoveCallback = t.removeCallback;
workspaceFolder = {