We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionGeneral Discussion,  Status › [PATCH] command line argument not passed on linux
Page Index Toggle Pages: 1
[PATCH] command line argument not passed on linux (Read 1926 times)
[PATCH] command line argument not passed on linux
Apr 14th, 2010, 7:06pm
 
btw, the bug tracker is still broken.

This patch builds on my previous patch on Slow startup when using System VM on Linux. Basically the linux startup script didn't pass its command line argument to processing.

Code:
Index: processing
===================================================================
--- processing (revision 6642)
+++ processing (working copy)
@@ -78,7 +78,7 @@
# Local JDK found?
if [ $SUCCESS -ne 1 ]; then
  # No, try using the preferred system JRE/JDK (if any)
-  JDKDIR=`which java` && JDKDIR=`readlink -e "$JDKDIR"` && JDKDIR=`dirname "$JDKDIR"`/..
+  JDKDIR="$JDK_HOME/"
  make_jdkcp "$JDKDIR"
  log SUCCESS
fi
@@ -97,4 +97,4 @@

# Start Processing in the same directory as this script
cd "$APPDIR"
-java processing.app.Base &
+java processing.app.Base "$@" &

Re: [PATCH] command line argument not passed on linux
Reply #1 - Apr 14th, 2010, 11:23pm
 
Nice one, so now you can open processing on the sketch of your choice, avoiding all that annoying filechooser stuff. Smiley
Re: [PATCH] command line argument not passed on linux
Reply #2 - Apr 15th, 2010, 3:51am
 
Basically yes. With the patch you can now start Processing on a sketch without the file chooser.

However, I haven't been able to successfully execute "processing --run mysketch.pde" to "run sketch without opening PDE"[1] which will be very useful to integrate processing with other text editors/IDE or integration to automated build system.

[1] currently this just opens the sketch in PDE
Re: [PATCH] command line argument not passed on linux
Reply #3 - Apr 15th, 2010, 4:50am
 
Quote:
I haven't been able to successfully execute "processing --run mysketch.pde"


Found it. Basically, instead of launching processing with 'java processing.app.Base "$@"', you launch with 'java processing.app.Commander "$@"' instead and passes the command line argument to the launcher script like:
processing --run --sketch=/home/username/sketchbook/sketch/ --output=/tmp/

However, apparently at the moment, the class processing.app.Commander is a little bit fragile, it causes Processing to crash with ArrayIndexOutOfBoundsException if you use ~ expansion (i.e. you can't use ~/sketchbook/sketch since Processing expands it to /current/working/directory/~/sketchbook/sketch which is unlikely to exists) and you face NullPointerException if you point to the .pde instead of the sketch directory.
Page Index Toggle Pages: 1