fix: use escape-path-with-spaces to fix new windows paths

This commit is contained in:
Amin Yahyaabadi 2022-05-11 17:13:27 -07:00
parent 51704ac849
commit 4109838bca
5 changed files with 14 additions and 7 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -37,6 +37,7 @@
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^1.7.2",
"escape-path-with-spaces": "^1.0.0",
"execa": "^5.1.1",
"mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",

View File

@ -23,6 +23,7 @@ specifiers:
cross-env: 7.0.3
cross-spawn: ^7.0.3
cspell: ^5.20.0
escape-path-with-spaces: ^1.0.0
eslint: ^8.14.0
eslint-config-atomic: ^1.17.1
execa: ^5.1.1
@ -52,6 +53,7 @@ dependencies:
'@actions/exec': 1.1.1
'@actions/io': 1.1.2
'@actions/tool-cache': 1.7.2
escape-path-with-spaces: 1.0.0
execa: 5.1.1
mri: 1.2.0
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
@ -3588,6 +3590,10 @@ packages:
engines: {node: '>=8'}
dev: true
/escape-path-with-spaces/1.0.0:
resolution: {integrity: sha512-+98Hh0yzVa0hldJXlzr0M/8B8LVXW9vNT5boC9k6o896Z52DGRplm3NwMGX0590ryGSegzTf/uaUiusFj2SQbQ==}
dev: false
/escape-string-regexp/1.0.5:
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
engines: {node: '>=0.8.0'}

View File

@ -1,11 +1,11 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import escape from "escape-path-with-spaces"
/// Escape the spaces in the given path
export function escapeSpace(path: string | undefined): string {
if (path === undefined) {
return ""
}
if (process.platform === "win32") {
return path.replace(/(\s+)/g, "%20")
} else {
return path.replace(/(\s+)/g, "\\$1")
}
return escape(path)
}