From 76e605657800def40becef7b499c9fc53f786fb2 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 5 Jan 2023 16:44:21 +0100 Subject: [PATCH] Ensure POSIX path normalizing behavior under NODERAWFS Avoids mangling `C:/tmp` to `C:\tmp`. Should be safe, the underlying Windows API can accept either the backslash or slash to separate directory and file components of a path. See: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file --- src/library_nodepath.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/library_nodepath.js b/src/library_nodepath.js index c42820f36e289..f867e4ccf2309 100644 --- a/src/library_nodepath.js +++ b/src/library_nodepath.js @@ -14,11 +14,11 @@ addToLibrary({ $PATH: { isAbs: (path) => nodePath['isAbsolute'](path), - normalize: (path) => nodePath['normalize'](path), + normalize: (path) => nodePath['posix']['normalize'](path), dirname: (path) => nodePath['dirname'](path), basename: (path) => nodePath['basename'](path), - join: (...args) => nodePath['join'](...args), - join2: (l, r) => nodePath['join'](l, r), + join: (...args) => nodePath['posix']['join'](...args), + join2: (l, r) => nodePath['posix']['join'](l, r), }, // The FS-using parts are split out into a separate object, so simple path // usage does not require the FS.