Skip to content

Commit a57b018

Browse files
authored
Fix path normalize check for Windows (#350)
`path.normalize` on Windows returns paths with back-slashes (\) instead of forward -slashes (/), which causes the check here to fail. This change fixes the issue by replacing all the back-slashes with forward-slashes.
1 parent dd1eb39 commit a57b018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Packages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class Packages {
88
constructor(public readonly projectRoot: string) {}
99
private cache: Map<string, ScipSymbol> = new Map()
1010
public symbol(filePath: string): ScipSymbol {
11-
if (path.normalize(filePath) !== filePath) {
11+
if (path.normalize(filePath).replaceAll('\\', '/') !== filePath) {
1212
throw new Error(
1313
`unexpected error: path.normalize('${filePath}') !== ${filePath}`
1414
)

0 commit comments

Comments
 (0)