diff --git a/packages/core/src/config/projectRegistry.test.ts b/packages/core/src/config/projectRegistry.test.ts index d3201133a6..26716eb6f6 100644 --- a/packages/core/src/config/projectRegistry.test.ts +++ b/packages/core/src/config/projectRegistry.test.ts @@ -13,6 +13,10 @@ import * as path from 'node:path'; import * as os from 'node:os'; import { ProjectRegistry } from './projectRegistry.js'; import { lock } from 'proper-lockfile'; +import { + normalizePath as normalizePathUtil, + resolveToRealPath, +} from '../utils/paths.js'; vi.mock('proper-lockfile'); @@ -23,11 +27,7 @@ describe('ProjectRegistry', () => { let baseDir2: string; function normalizePath(p: string): string { - let resolved = path.resolve(p); - if (os.platform() === 'win32') { - resolved = resolved.toLowerCase(); - } - return resolved; + return normalizePathUtil(resolveToRealPath(p)); } beforeEach(() => { diff --git a/packages/core/src/config/projectRegistry.ts b/packages/core/src/config/projectRegistry.ts index b50ee61cc2..885aab9cf8 100644 --- a/packages/core/src/config/projectRegistry.ts +++ b/packages/core/src/config/projectRegistry.ts @@ -7,12 +7,14 @@ import { randomUUID } from 'node:crypto'; import * as fs from 'node:fs'; import * as path from 'node:path'; -import * as os from 'node:os'; import { lock } from 'proper-lockfile'; import { z } from 'zod'; import { debugLogger } from '../utils/debugLogger.js'; import { isNodeError } from '../utils/errors.js'; -import { resolveToRealPath } from '../utils/paths.js'; +import { + normalizePath as normalizePathUtil, + resolveToRealPath, +} from '../utils/paths.js'; export interface RegistryData { projects: Record; @@ -94,11 +96,7 @@ export class ProjectRegistry { } private normalizePath(projectPath: string): string { - let resolved = resolveToRealPath(projectPath); - if (os.platform() === 'win32') { - resolved = resolved.toLowerCase(); - } - return resolved; + return normalizePathUtil(resolveToRealPath(projectPath)); } private async save(data: RegistryData): Promise {