From 58fc08840a4a64ca1935391f4709a784c3f0b373 Mon Sep 17 00:00:00 2001 From: 0x269 <33447608+truemogician@users.noreply.github.com> Date: Fri, 10 Feb 2023 00:31:44 +0800 Subject: [PATCH] fix: use forward slashes when normalizing path (#9768) Fixes #9766 --- src/platform/PlatformTools.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platform/PlatformTools.ts b/src/platform/PlatformTools.ts index 43147b1ee4..dc7d5c16c9 100644 --- a/src/platform/PlatformTools.ts +++ b/src/platform/PlatformTools.ts @@ -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 } /**