mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix: normalize path separators for cross-platform compatibility
- Ensure consistent cache keys across Windows and Unix systems - Replace backslashes with forward slashes in relative paths
This commit is contained in:
parent
a9b70e4e76
commit
743dc97ef4
2 changed files with 9 additions and 3 deletions
|
|
@ -80,7 +80,9 @@ describe("CacheManager", () => {
|
|||
relativePath = path.relative(homedir, mockWorkspacePath)
|
||||
}
|
||||
|
||||
const compositeKey = `${workspaceName}::${relativePath}`
|
||||
// Normalize path separators for consistency
|
||||
const normalizedRelativePath = relativePath.replace(/\\/g, "/")
|
||||
const compositeKey = `${workspaceName}::${normalizedRelativePath}`
|
||||
const expectedHash = createHash("sha256").update(compositeKey).digest("hex")
|
||||
|
||||
expect(vscode.Uri.joinPath).toHaveBeenCalledWith(
|
||||
|
|
|
|||
|
|
@ -56,10 +56,14 @@ export class CacheManager implements ICacheManager {
|
|||
console.warn("Failed to get relative path from home directory:", error)
|
||||
}
|
||||
|
||||
// Create a composite key using workspace name and relative path
|
||||
// Normalize path separators to forward slashes for consistency across platforms
|
||||
// This ensures the same cache key is generated regardless of the OS
|
||||
const normalizedRelativePath = relativePath.replace(/\\/g, "/")
|
||||
|
||||
// Create a composite key using workspace name and normalized relative path
|
||||
// This should be more stable across SSH sessions where the absolute path might change
|
||||
// but the relative structure remains the same
|
||||
const compositeKey = `${workspaceName}::${relativePath}`
|
||||
const compositeKey = `${workspaceName}::${normalizedRelativePath}`
|
||||
|
||||
// Generate hash from the composite key
|
||||
return createHash("sha256").update(compositeKey).digest("hex")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue