@@ -140,7 +140,7 @@ public String getSketchClassName() {
140140 * @return null if compilation failed, main class name if not
141141 */
142142 public String preprocess (File srcFolder , boolean sizeWarning ) throws SketchException {
143- PdePreprocessor preprocessor = PdePreprocessor .builderFor (sketch .getName ()).build ();
143+ PdePreprocessor preprocessor = PdePreprocessor .builderFor (sketch .getMainName ()).build ();
144144 return preprocess (srcFolder , null , preprocessor , sizeWarning );
145145 }
146146
@@ -231,7 +231,7 @@ public String preprocess(File srcFolder,
231231 srcFolder : new File (srcFolder , packageName .replace ('.' , '/' ));
232232 outputFolder .mkdirs ();
233233// Base.openFolder(outputFolder);
234- final File java = new File (outputFolder , sketch .getName () + ".java" );
234+ final File java = new File (outputFolder , sketch .getMainName () + ".java" );
235235 try (PrintWriter stream = PApplet .createWriter (java )) {
236236 result = preprocessor .write (stream , bigCode .toString (), codeFolderPackages );
237237 }
@@ -517,7 +517,7 @@ public SketchException placeException(String message,
517517 }
518518
519519 // If not the preprocessed file at this point, then need to get out
520- if (!dotJavaFilename .equals (sketch .getName () + ".java" )) {
520+ if (!dotJavaFilename .equals (sketch .getMainName () + ".java" )) {
521521 return null ;
522522 }
523523
@@ -566,10 +566,10 @@ protected boolean exportApplication() throws IOException, SketchException {
566566
567567 // if name != exportSketchName, then that's weirdness
568568 // BUG unfortunately, that can also be a bug in the preproc :(
569- if (!sketch .getName ().equals (foundName )) {
569+ if (!sketch .getMainName ().equals (foundName )) {
570570 Messages .showWarning ("Error during export" ,
571- "Sketch name is " + sketch .getName () + " but the sketch \n " +
572- "name in the code was " + foundName , null );
571+ "Main tab is named " + sketch .getMainName () + " but the\n " +
572+ "sketch name in the code was " + foundName , null );
573573 return false ;
574574 }
575575
@@ -710,7 +710,7 @@ protected boolean exportApplication(File destFolder,
710710 macosFolder .mkdirs ();
711711 // This is an unsigned copy of the app binary (see build/build.xml)
712712 Util .copyFile (mode .getContentFile ("application/mac-app-stub" ),
713- new File (contentsFolder , "MacOS/" + sketch .getName ()));
713+ new File (contentsFolder , "MacOS/" + sketch .getMainName ()));
714714
715715 File pkgInfo = new File (contentsFolder , "PkgInfo" );
716716 PrintWriter writer = PApplet .createWriter (pkgInfo );
@@ -755,7 +755,7 @@ protected boolean exportApplication(File destFolder,
755755 /// create the main .jar file
756756
757757 FileOutputStream zipOutputFile =
758- new FileOutputStream (new File (jarFolder , sketch .getName () + ".jar" ));
758+ new FileOutputStream (new File (jarFolder , sketch .getMainName () + ".jar" ));
759759 ZipOutputStream zos = new ZipOutputStream (zipOutputFile );
760760
761761 // add the manifest file so that the .jar can be double-clickable
@@ -797,7 +797,7 @@ protected boolean exportApplication(File destFolder,
797797 zos .flush ();
798798 zos .close ();
799799
800- jarList .append (sketch .getName () + ".jar" );
800+ jarList .append (sketch .getMainName () + ".jar" );
801801
802802
803803 /// add contents of 'library' folders to the export
@@ -904,7 +904,7 @@ protected boolean exportApplication(File destFolder,
904904 }
905905 while ((index = sb .indexOf ("@@sketch@@" )) != -1 ) {
906906 sb .replace (index , index + "@@sketch@@" .length (),
907- sketch .getName ());
907+ sketch .getMainName ());
908908 }
909909 while ((index = sb .indexOf ("@@lsuipresentationmode@@" )) != -1 ) {
910910 sb .replace (index , index + "@@lsuipresentationmode@@" .length (),
@@ -961,7 +961,7 @@ protected boolean exportApplication(File destFolder,
961961 config .addChild ("icon" ).setContent (iconFile .getAbsolutePath ());
962962
963963 XML clazzPath = config .addChild ("classPath" );
964- clazzPath .addChild ("mainClass" ).setContent (sketch .getName ());
964+ clazzPath .addChild ("mainClass" ).setContent (sketch .getMainName ());
965965 for (String jarName : jarList ) {
966966 clazzPath .addChild ("cp" ).setContent ("lib/" + jarName );
967967 }
@@ -1015,7 +1015,7 @@ protected boolean exportApplication(File destFolder,
10151015 //" -Djava.ext.dirs=\"$APPDIR/java/lib/ext\"" +
10161016 //" -Djna.nosys=true" +
10171017 " -cp \" " + exportClassPath + "\" " +
1018- " " + sketch .getName () + " \" $@\" \n " );
1018+ " " + sketch .getMainName () + " \" $@\" \n " );
10191019
10201020 pw .flush ();
10211021 pw .close ();
@@ -1042,7 +1042,7 @@ protected boolean exportApplication(File destFolder,
10421042 }
10431043 }
10441044 // move the .java file from the preproc there too
1045- String preprocFilename = sketch .getName () + ".java" ;
1045+ String preprocFilename = sketch .getMainName () + ".java" ;
10461046 File preprocFile = new File (srcFolder , preprocFilename );
10471047 if (preprocFile .exists ()) {
10481048 Util .copyFile (preprocFile , new File (sourceFolder , preprocFilename ));
@@ -1163,7 +1163,7 @@ protected void addManifest(ZipOutputStream zos) throws IOException {
11631163 String contents =
11641164 "Manifest-Version: 1.0\n " +
11651165 "Created-By: Processing " + Base .getVersionName () + "\n " +
1166- "Main-Class: " + sketch .getName () + "\n " ; // TODO not package friendly
1166+ "Main-Class: " + sketch .getMainName () + "\n " ; // TODO not package friendly
11671167 zos .write (contents .getBytes ());
11681168 zos .closeEntry ();
11691169 }
0 commit comments