|
32 | 32 | import cc.arduino.contributions.packages.ContributionsIndexer; |
33 | 33 | import cc.arduino.contributions.DownloadableContributionVersionComparator; |
34 | 34 | import cc.arduino.contributions.packages.ui.ContributionManagerUI; |
| 35 | +import cc.arduino.files.DeleteFilesOnShutdown; |
35 | 36 | import cc.arduino.packages.DiscoveryManager; |
36 | 37 | import cc.arduino.utils.Progress; |
37 | 38 | import cc.arduino.view.SplashScreenHelper; |
@@ -127,6 +128,8 @@ static public void main(String args[]) throws Exception { |
127 | 128 | } |
128 | 129 |
|
129 | 130 | static public void guardedMain(String args[]) throws Exception { |
| 131 | + Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE)); |
| 132 | + |
130 | 133 | BaseNoGui.initLogger(); |
131 | 134 |
|
132 | 135 | BaseNoGui.notifier = new GUIUserNotifier(); |
@@ -202,7 +205,7 @@ static public void guardedMain(String args[]) throws Exception { |
202 | 205 |
|
203 | 206 | // Create a location for untitled sketches |
204 | 207 | untitledFolder = createTempFolder("untitled"); |
205 | | - untitledFolder.deleteOnExit(); |
| 208 | + DeleteFilesOnShutdown.add(untitledFolder); |
206 | 209 |
|
207 | 210 | new Base(args); |
208 | 211 | } |
@@ -401,6 +404,7 @@ protected void onProgress(Progress progress) { |
401 | 404 | // Set verbosity for command line build |
402 | 405 | Preferences.set("build.verbose", "" + parser.isDoVerboseBuild()); |
403 | 406 | Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload()); |
| 407 | + Preferences.set("runtime.preserve.temp.files", Boolean.toString(parser.isPreserveTempFiles())); |
404 | 408 |
|
405 | 409 | // Make sure these verbosity preferences are only for the |
406 | 410 | // current session |
|
0 commit comments