diff options
| author | xq114 <[email protected]> | 2022-02-26 21:10:14 +0800 |
|---|---|---|
| committer | xq114 <[email protected]> | 2022-02-26 21:10:14 +0800 |
| commit | 91700ebc945e464c123baab9dad24fa03b476d70 (patch) | |
| tree | 3ddbdece6101a38b41dfa3273c310fcf4cde4e06 | |
| parent | 7282a7c84fc1543680f132b4e5e8840ce1cb28fd (diff) | |
improve xmake update integrate
| -rw-r--r-- | xmake/actions/update/main.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua index b96dfe02b..a49697058 100644 --- a/xmake/actions/update/main.lua +++ b/xmake/actions/update/main.lua @@ -294,8 +294,8 @@ function _initialize_shell() local outdata, errdata = try {function () return os.iorunv(psshell.program, {"-c", "Write-Output $PROFILE.CurrentUserAllHosts"}) end} if outdata then target = outdata:trim() - command = "if (Test-Path -Path \"%s\" -PathType Leaf) {\n . \"%s\"\n}" profile = path.join(os.programdir(), "scripts", "profile-win.ps1") + command = format("if (Test-Path -Path \"%s\" -PathType Leaf) {\n . \"%s\"\n}", profile, profile) else raise("failed to get profile location from powershell!") end @@ -306,8 +306,9 @@ function _initialize_shell() elseif shell:endswith("zsh") then target = "~/.zshrc" elseif shell:endswith("ksh") then target = "~/.kshrc" end - command = "[[ -s \"%s\" ]] && source \"%s\"" profile = path.join(os.programdir(), "scripts", "profile-unix.sh") + command = format("export XMAKE_ROOTDIR=\"%s\"\nexport PATH=\"$XMAKE_ROOTDIR:$PATH\"\n", path.directory(os.programfile())) + command = command .. format("[[ -s \"%s\" ]] && source \"%s\"", profile, profile) end -- trace @@ -324,7 +325,7 @@ function _initialize_shell() file = file .. "\n" end end - file = file .. "# >>> xmake >>>\n" .. format(command, profile, profile) .. "\n# <<< xmake <<<" + file = file .. "# >>> xmake >>>\n" .. command .. "\n# <<< xmake <<<" io.writefile(target, file) return true end, |
