@@ -253,7 +253,7 @@ public void handleDeleteCode() throws IOException {
253
253
editor .base .handleClose (editor );
254
254
} else {
255
255
// delete the file
256
- if (!current .delete (BaseNoGui . getBuildFolder ( sketch ).toPath ())) {
256
+ if (!current .delete (sketch . getBuildPath ( ).toPath ())) {
257
257
Base .showMessage (tr ("Couldn't do it" ),
258
258
I18n .format (tr ("Could not delete \" {0}\" ." ), current .getFileName ()));
259
259
return ;
@@ -614,43 +614,6 @@ public void importLibrary(UserLibrary lib) throws IOException {
614
614
editor .getCurrentTab ().setSelection (0 , 0 ); // scroll to start
615
615
}
616
616
617
- /**
618
- * Preprocess, Compile, and Run the current code.
619
- * <P>
620
- * There are three main parts to this process:
621
- * <PRE>
622
- * (0. if not java, then use another 'engine'.. i.e. python)
623
- *
624
- * 1. do the p5 language preprocessing
625
- * this creates a working .java file in a specific location
626
- * better yet, just takes a chunk of java code and returns a
627
- * new/better string editor can take care of saving this to a
628
- * file location
629
- *
630
- * 2. compile the code from that location
631
- * catching errors along the way
632
- * placing it in a ready classpath, or .. ?
633
- *
634
- * 3. run the code
635
- * needs to communicate location for window
636
- * and maybe setup presentation space as well
637
- * run externally if a code folder exists,
638
- * or if more than one file is in the project
639
- *
640
- * X. afterwards, some of these steps need a cleanup function
641
- * </PRE>
642
- */
643
- //protected String compile() throws RunnerException {
644
-
645
- /**
646
- * Run the build inside the temporary build folder.
647
- * @return null if compilation failed, main class name if not
648
- * @throws RunnerException
649
- */
650
- public String build (boolean verbose , boolean save ) throws RunnerException , PreferencesMapException , IOException {
651
- return build (BaseNoGui .getBuildFolder (sketch ).getAbsolutePath (), verbose , save );
652
- }
653
-
654
617
/**
655
618
* Preprocess and compile all the code for this sketch.
656
619
*
@@ -660,7 +623,7 @@ public String build(boolean verbose, boolean save) throws RunnerException, Prefe
660
623
*
661
624
* @return null if compilation failed, main class name if not
662
625
*/
663
- private String build (String buildPath , boolean verbose , boolean save ) throws RunnerException , PreferencesMapException , IOException {
626
+ public String build (boolean verbose , boolean save ) throws RunnerException , PreferencesMapException , IOException {
664
627
// run the preprocessor
665
628
editor .status .progressUpdate (20 );
666
629
@@ -678,7 +641,7 @@ private String build(String buildPath, boolean verbose, boolean save) throws Run
678
641
}
679
642
680
643
try {
681
- return new Compiler (pathToSketch , sketch , buildPath ).build (progressListener , save );
644
+ return new Compiler (pathToSketch , sketch ).build (progressListener , save );
682
645
} finally {
683
646
// Make sure we clean up any temporary sketch copy
684
647
if (deleteTemp )
@@ -697,20 +660,13 @@ private File saveSketchInTempFolder() throws IOException {
697
660
return Paths .get (tempFolder .getAbsolutePath (), sketch .getPrimaryFile ().getFileName ()).toFile ();
698
661
}
699
662
700
- protected boolean exportApplet (boolean usingProgrammer ) throws Exception {
701
- return exportApplet (BaseNoGui .getBuildFolder (sketch ).getAbsolutePath (), usingProgrammer );
702
- }
703
-
704
-
705
663
/**
706
664
* Handle export to applet.
707
665
*/
708
- private boolean exportApplet (String appletPath , boolean usingProgrammer )
709
- throws Exception {
710
-
666
+ protected boolean exportApplet (boolean usingProgrammer ) throws Exception {
711
667
// build the sketch
712
668
editor .status .progressNotice (tr ("Compiling sketch..." ));
713
- String foundName = build (appletPath , false , false );
669
+ String foundName = build (false , false );
714
670
// (already reported) error during export, exit this function
715
671
if (foundName == null ) return false ;
716
672
@@ -724,12 +680,12 @@ private boolean exportApplet(String appletPath, boolean usingProgrammer)
724
680
// }
725
681
726
682
editor .status .progressNotice (tr ("Uploading..." ));
727
- boolean success = upload (appletPath , foundName , usingProgrammer );
683
+ boolean success = upload (foundName , usingProgrammer );
728
684
editor .status .progressUpdate (100 );
729
685
return success ;
730
686
}
731
687
732
- private boolean upload (String buildPath , String suggestedClassName , boolean usingProgrammer ) throws Exception {
688
+ private boolean upload (String suggestedClassName , boolean usingProgrammer ) throws Exception {
733
689
734
690
UploaderUtils uploaderInstance = new UploaderUtils ();
735
691
Uploader uploader = uploaderInstance .getUploaderByPreferences (false );
@@ -751,7 +707,7 @@ private boolean upload(String buildPath, String suggestedClassName, boolean usin
751
707
752
708
List <String > warningsAccumulator = new LinkedList <>();
753
709
try {
754
- success = uploaderInstance .upload (sketch , uploader , buildPath , suggestedClassName , usingProgrammer , false , warningsAccumulator );
710
+ success = uploaderInstance .upload (sketch , uploader , suggestedClassName , usingProgrammer , false , warningsAccumulator );
755
711
} finally {
756
712
if (uploader .requiresAuthorization () && !success ) {
757
713
PreferencesData .remove (uploader .getAuthorizationKey ());
0 commit comments