fix: use forward slashes when normalizing path (#9768)

Fixes #9766
This commit is contained in:
0x269 2023-02-10 00:31:44 +08:00 committed by GitHub
parent 099fcd9b10
commit 58fc08840a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,10 +140,13 @@ export class PlatformTools {
}
/**
* Normalizes given path. Does "path.normalize".
* Normalizes given path. Does "path.normalize" and replaces backslashes with forward slashes on Windows.
*/
static pathNormalize(pathStr: string): string {
return path.normalize(pathStr)
let normalizedPath = path.normalize(pathStr)
if (process.platform === "win32")
normalizedPath = normalizedPath.replace(/\\/g, "/")
return normalizedPath
}
/**