Skip to content

Commit

Permalink
Fix use of unquoted paths
Browse files Browse the repository at this point in the history
The install script would fail when the `$INSTALL_LOCATION` included
spaces (and probably other characters as well).

This change quotes all the variables containing paths to avoid the
above issue.
  • Loading branch information
christianharrington authored and kitbellew committed Jun 2, 2022
1 parent 5ad937a commit 8e1d92d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/install-scalafmt-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ elif [ "$VERSION_COMPARE" -le 0 ]; then
fi

TMP=$(mktemp -d)
cd $TMP
cd "$TMP"
if [ "$VERSION_COMPARE" -le 0 ]; then
curl --fail -Lo $NAME https://github.com/scalameta/scalafmt/releases/download/$VERSION/$NAME
cp $NAME $INSTALL_LOCATION
cp $NAME "$INSTALL_LOCATION"
else
ZIP=$NAME.zip
curl --fail -Lo $ZIP https://github.com/scalameta/scalafmt/releases/download/$VERSION/$ZIP
unzip $ZIP
cp scalafmt $INSTALL_LOCATION
cp scalafmt "$INSTALL_LOCATION"
fi

chmod +x $INSTALL_LOCATION
chmod +x "$INSTALL_LOCATION"

cd $CWD
rm -rf $TMP
cd "$CWD"
rm -rf "$TMP"

echo Installed $INSTALL_LOCATION
echo Installed "$INSTALL_LOCATION"

0 comments on commit 8e1d92d

Please sign in to comment.