@@ -1160,10 +1160,13 @@ protected boolean exportApplication(File destFolder,
11601160 /// on macosx, need to copy .app skeleton since that's
11611161 /// also where the jar files will be placed
11621162 File dotAppFolder = null ;
1163+ String jdkFolderName = null ;
11631164 if (exportPlatform == PConstants .MACOSX ) {
11641165 dotAppFolder = new File (destFolder , sketch .getName () + ".app" );
11651166
11661167 File contentsOrig = new File (Base .getJavaHome (), "../../../../.." );
1168+ File jdkFolder = new File (Base .getJavaHome (), "../../.." );
1169+ jdkFolderName = jdkFolder .getCanonicalFile ().getName ();
11671170
11681171// File dotAppSkeleton = mode.getContentFile("application/template.app");
11691172// Base.copyDir(dotAppSkeleton, dotAppFolder);
@@ -1409,13 +1412,22 @@ protected boolean exportApplication(File destFolder,
14091412
14101413 /// figure out run options for the VM
14111414
1412- String runOptions = Preferences .get ("run.options" );
1415+ // this is too vague. if anyone is using it, we can bring it back
1416+ // String runOptions = Preferences.get("run.options");
1417+ List <String > runOptions = new ArrayList <String >();
14131418 if (Preferences .getBoolean ("run.options.memory" )) {
1414- runOptions += " -Xms" +
1415- Preferences .get ("run.options.memory.initial" ) + "m" ;
1416- runOptions += " -Xmx" +
1417- Preferences .get ("run.options.memory.maximum" ) + "m" ;
1419+ runOptions .add ("-Xms" + Preferences .get ("run.options.memory.initial" ) + "m" );
1420+ runOptions .add ("-Xmx" + Preferences .get ("run.options.memory.maximum" ) + "m" );
14181421 }
1422+
1423+ StringBuilder jvmOptionsList = new StringBuilder ();
1424+ for (String opt : runOptions ) {
1425+ jvmOptionsList .append (" <string>" );
1426+ jvmOptionsList .append (opt );
1427+ jvmOptionsList .append ("</string>" );
1428+ jvmOptionsList .append ('\n' );
1429+ }
1430+
14191431// if (exportPlatform == PConstants.MACOSX) {
14201432// // If no bits specified (libs are all universal, or no native libs)
14211433// // then exportBits will be 0, and can be controlled via "Get Info".
@@ -1430,10 +1442,12 @@ protected boolean exportApplication(File destFolder,
14301442 /// macosx: write out Info.plist (template for classpath, etc)
14311443
14321444 if (exportPlatform == PConstants .MACOSX ) {
1433- String PLIST_TEMPLATE = "template.plist" ;
1445+ //String PLIST_TEMPLATE = "template.plist";
1446+ String PLIST_TEMPLATE = "Info.plist.tmpl" ;
14341447 File plistTemplate = new File (sketch .getFolder (), PLIST_TEMPLATE );
14351448 if (!plistTemplate .exists ()) {
1436- plistTemplate = mode .getContentFile ("application/template.plist" );
1449+ //plistTemplate = mode.getContentFile("application/template.plist");
1450+ plistTemplate = mode .getContentFile ("application/Info.plist.tmpl" );
14371451 }
14381452 File plistFile = new File (dotAppFolder , "Contents/Info.plist" );
14391453 PrintWriter pw = PApplet .createWriter (plistFile );
@@ -1443,33 +1457,37 @@ protected boolean exportApplication(File destFolder,
14431457 if (lines [i ].indexOf ("@@" ) != -1 ) {
14441458 StringBuffer sb = new StringBuffer (lines [i ]);
14451459 int index = 0 ;
1446- while ((index = sb .indexOf ("@@vmoptions@@" )) != -1 ) {
1447- sb .replace (index , index + "@@vmoptions@@" .length (),
1448- runOptions );
1460+ while ((index = sb .indexOf ("@@jdk_folder@@" )) != -1 ) {
1461+ sb .replace (index , index + "@@jdk_folder@@" .length (),
1462+ jdkFolderName );
1463+ }
1464+ while ((index = sb .indexOf ("@@jvm_options_list@@" )) != -1 ) {
1465+ sb .replace (index , index + "@@jvm_options_list@@" .length (),
1466+ jvmOptionsList .toString ());
14491467 }
14501468 while ((index = sb .indexOf ("@@sketch@@" )) != -1 ) {
14511469 sb .replace (index , index + "@@sketch@@" .length (),
14521470 sketch .getName ());
14531471 }
1454- while ((index = sb .indexOf ("@@classpath@@" )) != -1 ) {
1455- sb .replace (index , index + "@@classpath@@" .length (),
1456- exportClassPath .toString ());
1457- }
1472+ // while ((index = sb.indexOf("@@classpath@@")) != -1) {
1473+ // sb.replace(index, index + "@@classpath@@".length(),
1474+ // exportClassPath.toString());
1475+ // }
14581476 while ((index = sb .indexOf ("@@lsuipresentationmode@@" )) != -1 ) {
14591477 sb .replace (index , index + "@@lsuipresentationmode@@" .length (),
14601478 Preferences .getBoolean ("export.application.fullscreen" ) ? "4" : "0" );
14611479 }
1462- while ((index = sb .indexOf ("@@lsarchitecturepriority@@" )) != -1 ) {
1463- // More about this mess: http://support.apple.com/kb/TS2827
1464- // First default to exportBits == 0 case
1465- String arch = "<string>x86_64</string>\n <string>i386</string>" ;
1466- if (exportBits == 32 ) {
1467- arch = "<string>i386</string>" ;
1468- } else if (exportBits == 64 ) {
1469- arch = "<string>x86_64</string>" ;
1470- }
1471- sb .replace (index , index + "@@lsarchitecturepriority@@" .length (), arch );
1472- }
1480+ // while ((index = sb.indexOf("@@lsarchitecturepriority@@")) != -1) {
1481+ // // More about this mess: http://support.apple.com/kb/TS2827
1482+ // // First default to exportBits == 0 case
1483+ // String arch = "<string>x86_64</string>\n <string>i386</string>";
1484+ // if (exportBits == 32) {
1485+ // arch = "<string>i386</string>";
1486+ // } else if (exportBits == 64) {
1487+ // arch = "<string>x86_64</string>";
1488+ // }
1489+ // sb.replace(index, index + "@@lsarchitecturepriority@@".length(), arch);
1490+ // }
14731491
14741492 lines [i ] = sb .toString ();
14751493 }
0 commit comments