diff options
| author | ruki <[email protected]> | 2021-01-13 15:50:30 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-13 15:50:30 +0800 |
| commit | 8e6b8624edfba6725df0c53c912be158c1900c11 (patch) | |
| tree | b92c0d6d544b54799507c64eaa28145bc8072f0a | |
| parent | dc5ca1d6899eae23268dfac0b7ead5051a788aae (diff) | |
| parent | 3bbc5074add71d4f5d864f6cfe02abb6646ac4ac (diff) | |
Merge pull request #1195 from xmake-io/unicode
fix msvc and unicode
| -rw-r--r-- | .github/workflows/windows.yml | 2 | ||||
| m--------- | core/src/tbox/tbox | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 13 |
3 files changed, 10 insertions, 5 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 355d43f6a..290be340e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -149,7 +149,7 @@ jobs: uses: WyriHaximus/github-action-get-previous-tag@master - name: Upload artifacts to lastest release - if: ${{ env.GITHUB_REF_SLUG }} == 'dev' || ${{ env.GITHUB_REF_SLUG }} == 'master' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox -Subproject 3b24fdb96bccec99b2fbb99f1d6b04f67f249da +Subproject 6e5fb77c5ab5c0d712871c52c42a5bc7843cd78 diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 309b3dd64..d908bcc5a 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -43,9 +43,11 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt) -- make the genvcvars.bat opt = opt or {} local genvcvars_bat = os.tmpfile() .. "_genvcvars.bat" - local genvcvars_dat = os.tmpfile() .. "_genvcvars.txt" local file = io.open(genvcvars_bat, "w") file:print("@echo off") + -- @note we need get utf8 output from cmd.exe + -- because some %PATH% and other envs maybe contains unicode characters + file:print("chcp 65001") -- fix error caused by the new vsDevCmd.bat of vs2019 -- @see https://github.com/xmake-io/xmake/issues/549 if vsver and tonumber(vsver) >= 16 then @@ -57,16 +59,19 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt) file:print("call \"%s\" %s %s > nul", vcvarsall, arch, opt.sdkver and opt.sdkver or "") end for idx, var in ipairs(vcvars) do - file:print("echo " .. var .. " = %%" .. var .. "%% %s %s", idx == 1 and ">" or ">>", genvcvars_dat) + file:print("echo " .. var .. " = %%" .. var .. "%%") end file:close() -- run genvcvars.bat - os.run(genvcvars_bat) + local outdata = try {function () return os.iorun(genvcvars_bat) end} + if not outdata then + return + end -- load all envirnoment variables local variables = {} - for _, line in ipairs((io.readfile(genvcvars_dat) or ""):split("\n")) do + for _, line in ipairs(outdata:split("\n")) do local p = line:find('=', 1, true) if p then local name = line:sub(1, p - 1):trim() |
