diff --git a/scripts/test-gateway.mjs b/scripts/test-gateway.mjs index 313e35d6..83fff12c 100644 --- a/scripts/test-gateway.mjs +++ b/scripts/test-gateway.mjs @@ -73,12 +73,22 @@ export function resolveComposeNetworkName(rootDir, env = process.env) { return `${resolveComposeProjectName(rootDir, env)}_default`; } +function usesWindowsPathSyntax(filePath) { + return /^[A-Za-z]:[\\/]/.test(filePath) || filePath.startsWith("\\\\"); +} + +function pathForInputs(...filePaths) { + return filePaths.some((filePath) => usesWindowsPathSyntax(String(filePath || ""))) ? path.win32 : path; +} + export function resolveConfigDirectory(rootDir, explicitDir = null) { + const pathModule = pathForInputs(rootDir, explicitDir); + if (explicitDir) { - return path.resolve(rootDir, explicitDir); + return pathModule.resolve(rootDir, explicitDir); } - return path.join(rootDir, ".tmp", "test-gateway"); + return pathModule.join(rootDir, ".tmp", "test-gateway"); } export function shouldClaimGateway(existingConfig = {}, installToken = "") {