diff --git a/src/main/utils/metadataExtraction.ts b/src/main/utils/metadataExtraction.ts index 8281d9bc..e43c80d0 100644 --- a/src/main/utils/metadataExtraction.ts +++ b/src/main/utils/metadataExtraction.ts @@ -13,6 +13,17 @@ import type { FileSystemProvider } from '../services/infrastructure/FileSystemPr const logger = createLogger('Util:metadataExtraction'); +/** + * Normalize Windows drive letter to uppercase for consistent path comparison. + * CLI uses uppercase (C:\...) while VS Code extension uses lowercase (c:\...). + */ +function normalizeDriveLetter(p: string): string { + if (p.length >= 2 && p[1] === ':') { + return p[0].toUpperCase() + p.slice(1); + } + return p; +} + const defaultProvider = new LocalFileSystemProvider(); interface MessagePreview { @@ -48,7 +59,7 @@ export async function extractCwd( if ('cwd' in entry && entry.cwd) { rl.close(); fileStream.destroy(); - return entry.cwd; + return normalizeDriveLetter(entry.cwd); } } } catch (error) { diff --git a/test/main/services/discovery/SessionSearcher.test.ts b/test/main/services/discovery/SessionSearcher.test.ts index 88aa36b7..385fa83c 100644 --- a/test/main/services/discovery/SessionSearcher.test.ts +++ b/test/main/services/discovery/SessionSearcher.test.ts @@ -10,7 +10,7 @@ describe('SessionSearcher', () => { afterEach(() => { for (const dir of tempDirs) { - fs.rmSync(dir, { recursive: true, force: true }); + fs.rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } tempDirs.length = 0; });