JAL-3247 First attempt at getdown code to add macOS startup filenames to the appargs...
[jalview.git] / getdown / src / getdown / launcher / src / main / java / com / threerings / getdown / launcher / Getdown.java
index 99def4f..ae679e2 100644 (file)
@@ -1035,6 +1035,37 @@ public abstract class Getdown extends Thread
         }
     };
 
+    public void setStartupFilesFromParameterString(String p) {
+      String q = "\"";
+      if (p != null && p.length() > 0) {
+        String[] filenames;
+        if (p.startsWith(q) && p.endsWith(q)) {
+          filenames = p.substring(1,p.length()-1).split("\" \"");
+        } else {
+          filenames = new String[]{p};
+        }
+        for (int i = 0; i < filenames.length; i++) {
+          String filename = filenames[i];
+          String ext = null;
+          int j = filename.lastIndexOf('.');
+          if (j > -1) {
+            ext = filename.substring(j+1);
+          }
+          // jvp files
+          if (ext.equals("jvp")) {
+            File f = new File(filename);
+            if (f.exists()) {
+              _app.addStartupFile(f);
+            }
+          }
+          // jvl files
+          if (ext.equals("jvl")) {
+            // Do stuff with the appbase here!
+          }
+        }
+      }
+    }
+
     protected Application _app;
     protected Application.UpdateInterface _ifc = new Application.UpdateInterface(Config.EMPTY);