Description
I built the repo and replaced DOWNLOAD_URL
in swiftly-install.sh
with the build I made.
The UI displays $HOME/Library/Application
where it should show $HOME/Library/Application Support/swiftly
% ./swiftly-install.sh
This script will install swiftly, a Swift toolchain installer and manager.
Current installation options:
Data and configuration files directory: $HOME/Library/Application
Executables installation directory: $HOME/Library/Application
Modify login config ($HOME/.zprofile): true
Install system dependencies: true
Select one of the following:
1) Proceed with the installation (default)
2) Customize the installation
3) Cancel
> 1
Downloading swiftly from https://brianhenryie.s3.amazonaws.com/2024/swiftly...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18.7M 100 18.7M 0 0 5497k 0 0:00:03 0:00:03 --:--:-- 5499k
swiftly has been successfully installed!
Once you log in again, swiftly should be accessible from your PATH.
To begin using swiftly from your current shell, first run the following command:
. $HOME/Library/Application/env.sh
Then to install the latest version of Swift, run 'swiftly install latest'
Warning: existing installation of Swift detected at /usr/bin/swift
To ensure swiftly-installed toolchains can be found by the shell, uninstall any existing Swift installation(s).
To ensure the current shell can find swiftly-installed toolchains, you may also need to run 'hash -r'.
When I open a new Terminal shell
/Users/brianhenry/.zprofile:.:9: no such file or directory: /Users/brianhenry/Library/Application/env.sh
and
% swiftly
zsh: command not found: swiftly
The binary was correctly installed
% ls $HOME/Library/Application\ Support/swiftly/bin/
swiftly
but the env.sh
file seems to have escaping problems
cat $HOME/Library/Application\ Support/swiftly/env.sh
export SWIFTLY_HOME_DIR="$HOME/Library/Application"
export SWIFTLY_BIN_DIR="$HOME/Library/Application"
if [[ ":$PATH:" != *":$SWIFTLY_BIN_DIR:"* ]]; then
export PATH="$SWIFTLY_BIN_DIR:$PATH"
fi
The problem is in the replace_home_path
function:
swiftly/install/swiftly-install.sh
Lines 94 to 103 in bcfd843
which I think can be fixed with:
replace_home_path () {
if [[ "$@" =~ ^"$HOME"(.*|$) ]]; then
printf "\$HOME${BASH_REMATCH[1]}"
else
echo "there"
echo "$1"
fi
}
And also use $@
in the bold
function:
swiftly/install/swiftly-install.sh
Lines 112 to 115 in bcfd843
bold () {
echo "$(tput bold)$@$(tput sgr0)"
}
Then the path put into the source
command needs to be quoted:
swiftly/install/swiftly-install.sh
Line 651 in bcfd843
SOURCE_LINE=". \"$(replace_home_path $HOME_DIR)/$ENV_FILE\""
I'll put together a PR with those changes now, but I don't know what, if any, impact it will have when run under Linux.