arePathsEqual to do a case-insensitive check on windows

This commit is contained in:
Nate 2024-09-29 14:12:59 -07:00
parent c9324542fc
commit a3fa8653b9
2 changed files with 13 additions and 1 deletions

View file

@ -24,6 +24,7 @@ import {
getControlPlaneSessionInfo,
WorkOsAuthProvider,
} from "../stubs/WorkOsAuthProvider";
import { arePathsEqual } from "../util/arePathsEqual";
import { Battery } from "../util/battery";
import { AUTH_TYPE, EXTENSION_NAME } from "../util/constants";
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
@ -228,7 +229,7 @@ export class VsCodeExtension {
// Listen for file changes in the workspace
const filepath = event.uri.fsPath;
if (filepath === getConfigJsonPath()) {
if (arePathsEqual(filepath, getConfigJsonPath())) {
// Trigger a toast notification to provide UI feedback that config
// has been updated
const showToast = context.globalState.get<boolean>(

View file

@ -0,0 +1,11 @@
import * as os from "os";
export function arePathsEqual(path1: string, path2: string): boolean {
if (os.platform() === "win32") {
// On Windows, compare paths case-insensitively
return path1.toLowerCase() === path2.toLowerCase();
} else {
// On other platforms, compare paths case-sensitively
return path1 === path2;
}
}