@@ -112,36 +112,45 @@ public void run() {
112112 }
113113
114114 private String getBuildFolderPath (Sketch s ) {
115+ // first of all try the getBuildPath() function introduced with IDE 1.6.12
116+ // see commit arduino/Arduino#fd1541eb47d589f9b9ea7e558018a8cf49bb6d03
115117 try {
116- File buildFolder = FileUtils .createTempFolder ("build" , DigestUtils .md5Hex (s .getMainFilePath ()) + ".spiffs" );
117- DeleteFilesOnShutdown .add (buildFolder );
118- return buildFolder .getAbsolutePath ();
118+ String buildpath = s .getBuildPath ().getAbsolutePath ();
119+ return buildpath ;
119120 }
120- catch (IOException e ) {
121- editor .statusError (e );
121+ catch (IOException er ) {
122+ editor .statusError (er );
122123 }
123- catch (NoSuchMethodError e ) {
124- // Arduino 1.6.5 doesn't have FileUtils.createTempFolder
125- // String buildPath = BaseNoGui.getBuildFolder().getAbsolutePath();
126- java .lang .reflect .Method method ;
124+ catch (Exception er ) {
127125 try {
128- method = BaseNoGui .class .getMethod ("getBuildFolder" );
129- File f = (File ) method .invoke (null );
130- return f .getAbsolutePath ();
131- } catch (SecurityException ex ) {
132- editor .statusError (ex );
133- } catch (IllegalAccessException ex ) {
134- editor .statusError (ex );
135- } catch (InvocationTargetException ex ) {
136- editor .statusError (ex );
137- } catch (NoSuchMethodException ex ) {
138- editor .statusError (ex );
126+ File buildFolder = FileUtils .createTempFolder ("build" , DigestUtils .md5Hex (s .getMainFilePath ()) + ".tmp" );
127+ return buildFolder .getAbsolutePath ();
128+ }
129+ catch (IOException e ) {
130+ editor .statusError (e );
131+ }
132+ catch (Exception e ) {
133+ // Arduino 1.6.5 doesn't have FileUtils.createTempFolder
134+ // String buildPath = BaseNoGui.getBuildFolder().getAbsolutePath();
135+ java .lang .reflect .Method method ;
136+ try {
137+ method = BaseNoGui .class .getMethod ("getBuildFolder" );
138+ File f = (File ) method .invoke (null );
139+ return f .getAbsolutePath ();
140+ } catch (SecurityException ex ) {
141+ editor .statusError (ex );
142+ } catch (IllegalAccessException ex ) {
143+ editor .statusError (ex );
144+ } catch (InvocationTargetException ex ) {
145+ editor .statusError (ex );
146+ } catch (NoSuchMethodException ex ) {
147+ editor .statusError (ex );
148+ }
139149 }
140150 }
141151 return "" ;
142152 }
143153
144-
145154 private long getIntPref (String name ){
146155 String data = BaseNoGui .getBoardPreferences ().get (name );
147156 if (data == null || data .contentEquals ("" )) return 0 ;
@@ -150,7 +159,7 @@ private long getIntPref(String name){
150159 }
151160
152161 private void createAndUpload (){
153- if (!PreferencesData .get ("target_platform" ).contentEquals ("esp8266" ) && ! PreferencesData . get ( "target_platform" ). contentEquals ( "esp31b" ) && ! PreferencesData . get ( "target_platform" ). contentEquals ( "ESP31B" ) ){
162+ if (!PreferencesData .get ("target_platform" ).contentEquals ("esp8266" )){
154163 System .err .println ();
155164 editor .statusError ("SPIFFS Not Supported on " +PreferencesData .get ("target_platform" ));
156165 return ;
0 commit comments