|
39 | 39 | import processing.app.Platform; |
40 | 40 | import processing.app.PreferencesData; |
41 | 41 | import processing.app.Sketch; |
42 | | -import processing.app.SketchData; |
| 42 | +//import processing.app.SketchData; |
43 | 43 | import processing.app.debug.TargetPlatform; |
44 | 44 | import processing.app.helpers.FileUtils; |
45 | 45 | import processing.app.helpers.ProcessUtils; |
@@ -121,32 +121,43 @@ public void run() { |
121 | 121 | } |
122 | 122 |
|
123 | 123 | private String getBuildFolderPath(Sketch s) { |
124 | | - try { |
125 | | - File buildFolder = FileUtils.createTempFolder("build", DigestUtils.md5Hex(s.getMainFilePath()) + ".tmp"); |
126 | | - //DeleteFilesOnShutdown.add(buildFolder); |
127 | | - return buildFolder.getAbsolutePath(); |
128 | | - } |
129 | | - catch (IOException e) { |
130 | | - editor.statusError(e); |
131 | | - } |
132 | | - catch (NoSuchMethodError 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 | | - } |
149 | | - } |
| 124 | + // first of all try the getBuildPath() function introduced with IDE 1.6.12 |
| 125 | + // see commit arduino/Arduino#fd1541eb47d589f9b9ea7e558018a8cf49bb6d03 |
| 126 | + try { |
| 127 | + String buildpath = s.getBuildPath().getAbsolutePath(); |
| 128 | + return buildpath; |
| 129 | + } |
| 130 | + catch (IOException er) { |
| 131 | + editor.statusError(er); |
| 132 | + } |
| 133 | + catch (NoSuchMethodError er) { |
| 134 | + try { |
| 135 | + File buildFolder = FileUtils.createTempFolder("build", DigestUtils.md5Hex(s.getMainFilePath()) + ".tmp"); |
| 136 | + //DeleteFilesOnShutdown.add(buildFolder); |
| 137 | + return buildFolder.getAbsolutePath(); |
| 138 | + } |
| 139 | + catch (IOException e) { |
| 140 | + editor.statusError(e); |
| 141 | + } |
| 142 | + catch (NoSuchMethodError e) { |
| 143 | + // Arduino 1.6.5 doesn't have FileUtils.createTempFolder |
| 144 | + // String buildPath = BaseNoGui.getBuildFolder().getAbsolutePath(); |
| 145 | + java.lang.reflect.Method method; |
| 146 | + try { |
| 147 | + method = BaseNoGui.class.getMethod("getBuildFolder"); |
| 148 | + File f = (File) method.invoke(null); |
| 149 | + return f.getAbsolutePath(); |
| 150 | + } catch (SecurityException ex) { |
| 151 | + editor.statusError(ex); |
| 152 | + } catch (IllegalAccessException ex) { |
| 153 | + editor.statusError(ex); |
| 154 | + } catch (InvocationTargetException ex) { |
| 155 | + editor.statusError(ex); |
| 156 | + } catch (NoSuchMethodException ex) { |
| 157 | + editor.statusError(ex); |
| 158 | + } |
| 159 | + } |
| 160 | + } |
150 | 161 | return ""; |
151 | 162 | } |
152 | 163 |
|
|
0 commit comments