<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
 .DS_Store
 *.sw*
-*.gem
\ No newline at end of file
+*.gem
+extras
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -190,7 +190,9 @@ module Processing
     # If you'd like to do something fancy, feel free.
     def set_sketch_path(path=nil)
       field = self.java_class.declared_field('sketchPath')
-      field.set_value(Java.ruby_to_java(self), path || File.dirname(SKETCH_PATH))
+      local = File.dirname(SKETCH_PATH)
+      default = $__windows_app_mode__ ? &quot;#{local}/lib&quot; : local
+      field.set_value(Java.ruby_to_java(self), path || default)
     end
 
 </diff>
      <filename>lib/ruby-processing/app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -63,9 +63,9 @@ module Processing
       libs = []
       code = source.dup
       loop do
-        matchdata = code.match(/load_\w+_library.+?[&quot;':](\S+?)[&quot;'\s]/)
+        matchdata = code.match(/load\w+librar(y|ies).+?[&quot;':](\S+?)[&quot;'\s]/)
         break unless matchdata
-        match = matchdata[1]
+        match = matchdata[2]
         @opengl = true if match.match(/opengl/i)
         local_path = &quot;#{local_dir}/library/#{match}&quot;
         rp5_path = &quot;#{RP5_ROOT}/library/#{match}&quot;</diff>
      <filename>lib/ruby-processing/exporters/base_exporter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -117,13 +117,22 @@ module Processing
     
     # Trade in this Ruby instance for a JRuby instance, loading in a 
     # starter script and passing it some arguments.
-    def spin_up(starter_script, args)
+    def spin_up(starter_script, sketch)
       runner = &quot;#{RP5_ROOT}/lib/ruby-processing/runners/#{starter_script}&quot;
-      command = &quot;java -cp #{jruby_complete} #{dock_icon} org.jruby.Main #{runner} #{args}&quot;
+      java_args = discover_java_args(sketch)
+      command = &quot;java #{java_args} -cp #{jruby_complete} #{dock_icon} org.jruby.Main #{runner} #{sketch}&quot;
       exec(command)
       # exec replaces the Ruby process with the JRuby one.
     end
     
+    # If you need to pass in arguments to Java, such as the ones on this page:
+    # http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html
+    # then type them into a java_args.txt in your data directory next to your sketch.
+    def discover_java_args(sketch)
+      arg_file = &quot;#{File.dirname(sketch)}/data/java_args.txt&quot;
+      File.exists?(arg_file) ? File.read(arg_file).gsub(&quot;\n&quot;, &quot; &quot;) : ''
+    end
+    
     def ensure_exists(sketch)
       puts &quot;Couldn't find: #{sketch}&quot; and exit unless File.exists?(sketch)
     end</diff>
      <filename>lib/ruby-processing/runner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,10 @@
 # Windows apps start life in the wrong folder.
-ARGV[1] = nil and Dir.chdir('lib') if ARGV[1] == '--windows-app'
+# TODO: Fix this crud as soon as possible.
+if ARGV[1] == '--windows-app'
+  ARGV[1] = nil
+  Dir.chdir('lib')
+  $__windows_app_mode__ = true
+end
 
 require &quot;#{File.dirname(__FILE__)}/base.rb&quot;
 require Processing::SKETCH_PATH
\ No newline at end of file</diff>
      <filename>lib/ruby-processing/runners/run.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d42ff1174c5150e03f578279dbc8677a8cece78c</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </author>
  <url>http://github.com/jashkenas/ruby-processing/commit/e81457d3828dda6476117fcf270d0c5a5687201e</url>
  <id>e81457d3828dda6476117fcf270d0c5a5687201e</id>
  <committed-date>2009-01-19T21:04:50-08:00</committed-date>
  <authored-date>2009-01-19T21:04:50-08:00</authored-date>
  <message>Fixing application exporting inconsistencies on windows and library loading in exported applications and adding a hidden java_args.txt option</message>
  <tree>4d2f36a87632ce3850f28a3eeba33fa97ddc9a4e</tree>
  <committer>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </committer>
</commit>
