Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 966ae57

Browse files
committedFeb 9, 2023
fix: use forward slashes when normalizing path
Fixes typeorm#9766
1 parent 099fcd9 commit 966ae57

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/platform/PlatformTools.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,13 @@ export class PlatformTools {
140140
}
141141

142142
/**
143-
* Normalizes given path. Does "path.normalize".
143+
* Normalizes given path. Does "path.normalize" and replaces backslashes with forward slashes.
144144
*/
145145
static pathNormalize(pathStr: string): string {
146-
return path.normalize(pathStr)
146+
let normalizedPath = path.normalize(pathStr)
147+
if (process.platform === "win32")
148+
normalizedPath = normalizedPath.replace(/\\/g, "/")
149+
return normalizedPath
147150
}
148151

149152
/**

0 commit comments

Comments
 (0)