Skip to content

Commit cd7621d

Browse files
committed
fix(dlx): normalize paths for cross-platform isInSocketDlx comparison
Fix path comparison in isInSocketDlx() to work correctly on Windows: - Normalize absolutePath using normalizePath() for consistent forward slashes - Use '/' separator instead of path.sep for normalized path comparison - getSocketDlxDir() already returns normalized paths (forward slashes) - path.resolve() returns platform-specific paths (backslashes on Windows) Without normalization, Windows paths with backslashes failed to match the DLX directory path with forward slashes, causing test failures. Resolves Windows CI test failure: 'should return true for paths within DLX directory'
1 parent 5a26525 commit cd7621d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dlx.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ export function isInSocketDlx(filePath: string): boolean {
178178

179179
const path = getPath()
180180
const dlxDir = getSocketDlxDir()
181-
const absolutePath = path.resolve(filePath)
181+
const absolutePath = normalizePath(path.resolve(filePath))
182182

183183
// Check if the absolute path starts with the DLX directory.
184-
return absolutePath.startsWith(dlxDir + path.sep)
184+
// Both paths are normalized to use forward slashes for consistent comparison.
185+
return absolutePath.startsWith(dlxDir + '/')
185186
}
186187

187188
/**

0 commit comments

Comments
 (0)