Skip to content

Commit

Permalink
Merge pull request #5108 from wanzzhehe/master
Browse files Browse the repository at this point in the history
Fix adding duplicate paths to PATH during installation
  • Loading branch information
waruqi authored May 16, 2024
2 parents 95f8740 + b3f9bd3 commit fdb3168
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ fi
#
install_profile() {
export XMAKE_ROOTDIR="$prefix/bin"
export PATH="$XMAKE_ROOTDIR:$PATH"
[[ "$PATH" =~ (^|:)"$XMAKE_ROOTDIR"(:|$) ]] || export PATH="$XMAKE_ROOTDIR:$PATH"
xmake --version
xmake update --integrate
}
Expand Down
2 changes: 1 addition & 1 deletion xmake/actions/update/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function _initialize_shell()
local profile_fish = "$XMAKE_PROGRAM_DIR/scripts/profile-unix.fish"
local bridge_command = format([[export XMAKE_ROOTDIR="%s"
export XMAKE_PROGRAM_DIR="%s"
export PATH="$XMAKE_ROOTDIR:$PATH"
# export PATH="$XMAKE_ROOTDIR:$PATH"
test $FISH_VERSION && test -f "%s" && source "%s" && exit 0
test -f "%s" && source "%s"
]], path.directory(os.programfile()), os.programdir(), profile_fish, profile_fish, profile, profile)
Expand Down
4 changes: 4 additions & 0 deletions xmake/scripts/profile-unix.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# @homepage profile-unix.fish
#

# register PATH
string match --regex --quiet "(^|:)$XMAKE_ROOTDIR(:|\$)" "$PATH" || \
export PATH="$XMAKE_ROOTDIR:$PATH"

# register environments
export XMAKE_SHELL=fish

Expand Down
3 changes: 3 additions & 0 deletions xmake/scripts/profile-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# @homepage profile-unix.sh
#

# register PATH
[[ "$PATH" =~ (^|:)"$XMAKE_ROOTDIR"(:|$) ]] || export PATH="$XMAKE_ROOTDIR:$PATH"

# register completions
if [[ -n "$ZSH_VERSION" ]]; then
export XMAKE_SHELL=zsh
Expand Down

0 comments on commit fdb3168

Please sign in to comment.