Skip to content

Allow spaces in IDE install path on Linux #3973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions build/linux/dist/arduino
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"

for LIB in \
$APPDIR/java/lib/rt.jar \
$APPDIR/java/lib/tools.jar \
$APPDIR/lib/*.jar \
"$APPDIR"/java/lib/rt.jar \
"$APPDIR"/java/lib/tools.jar \
"$APPDIR"/lib/*.jar \
;
do
CLASSPATH="${CLASSPATH}:${LIB}"
Expand All @@ -17,18 +17,19 @@ export LD_LIBRARY_PATH

export PATH="${APPDIR}/java/bin:${PATH}"

if [[ "$@" == *"--upload"* || "$@" == *"--verify"* || "$@" == *"--get-pref"* || "$@" == *"--install-board"* || "$@" == *"--install-library"* ]] ; then
SPLASH=""
else
SPLASH="-splash:$APPDIR/lib/splash.png"
fi

export JAVA_TOOL_OPTIONS=`echo $JAVA_TOOL_OPTIONS | sed 's|-javaagent:/usr/share/java/jayatanaag.jar||g'`

JAVA=java
if [ -x $APPDIR/java/bin/java ]; then
if [ -x "$APPDIR/java/bin/java" ]; then
JAVA=$APPDIR/java/bin/java
fi

$JAVA -DAPP_DIR="$APPDIR" -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel $SPLASH processing.app.Base "$@"
# Collect options to java in an array, to properly handle whitespace in options
JAVA_OPTIONS=("-DAPP_DIR=$APPDIR" "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel")

if [[ "$@" != *"--upload"* && "$@" != *"--verify"* && "$@" != *"--get-pref"* && "$@" != *"--install-board"* && "$@" != *"--install-library"* ]] ; then
JAVA_OPTIONS+=("-splash:$APPDIR/lib/splash.png")
fi

$JAVA "${JAVA_OPTIONS[@]}" processing.app.Base "$@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable JAVA can be obtained from:

JAVA=$APPDIR/java/bin/java

when the if on line 24 is followed and, since APPDIR may contain spaces, the last line should be changed to:

"$JAVA" "${JAVA_OPTIONS[@]}" processing.app.Base "$@"

(adding quotes to the $JAVA call), do you agree?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, agreed! Will you change it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we go a6602ca