[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Allow choosing an image via zenity when no arguments are provided (#408)

Fabio Niephaus notifications at github.com
Mon Jun 17 17:49:45 UTC 2019


fniephaus requested changes on this pull request.



> @@ -53,4 +53,15 @@ case $PLATFORMLIBDIR in
 /lib|/usr/lib)	SVMLLP=/lib:/usr/lib;;
 *)				SVMLLP="$PLATFORMLIBDIR:/lib:/usr$PLATFORMLIBDIR:/usr/lib"
 esac
-LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB "$BIN/squeak" "$@"
+
+# If no image file is provided as a command-line argument, allow the user to 
+# select the image file via a file-chooser dialog
+if which zenity &>/dev/null && [ $# -eq 0 ]; then

Could you please swap left and right? No need to check if `zenity` is installed if there are more args anyway.

> @@ -53,4 +53,15 @@ case $PLATFORMLIBDIR in
 /lib|/usr/lib)	SVMLLP=/lib:/usr/lib;;
 *)				SVMLLP="$PLATFORMLIBDIR:/lib:/usr$PLATFORMLIBDIR:/usr/lib"
 esac
-LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB "$BIN/squeak" "$@"
+
+# If no image file is provided as a command-line argument, allow the user to 
+# select the image file via a file-chooser dialog
+if which zenity &>/dev/null && [ $# -eq 0 ]; then
+  IMAGE=$(zenity --title 'Select an image' --file-selection --filename "${RESOURCES}/" --file-filter '*.image' --file-filter '*')

`IMAGE` is also used for all args (below), so please rename to something like `VM_ARGS`.
Also, `${RESOURCES}` is not defined, maybe remove `--filename "${RESOURCES}/"`?

> @@ -53,4 +53,15 @@ case $PLATFORMLIBDIR in
 /lib|/usr/lib)	SVMLLP=/lib:/usr/lib;;
 *)				SVMLLP="$PLATFORMLIBDIR:/lib:/usr$PLATFORMLIBDIR:/usr/lib"
 esac
-LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB "$BIN/squeak" "$@"
+
+# If no image file is provided as a command-line argument, allow the user to 
+# select the image file via a file-chooser dialog
+if which zenity &>/dev/null && [ $# -eq 0 ]; then
+  IMAGE=$(zenity --title 'Select an image' --file-selection --filename "${RESOURCES}/" --file-filter '*.image' --file-filter '*')
+else
+  IMAGE=$@
+fi
+
+echo "Using image: ${IMAGE}"

Please remove this print message.

> @@ -53,4 +53,15 @@ case $PLATFORMLIBDIR in
 /lib|/usr/lib)	SVMLLP=/lib:/usr/lib;;
 *)				SVMLLP="$PLATFORMLIBDIR:/lib:/usr$PLATFORMLIBDIR:/usr/lib"
 esac
-LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB "$BIN/squeak" "$@"

See comments for other file...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/408#pullrequestreview-250646654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190617/733a253c/attachment.html>


More information about the Vm-dev mailing list