mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-25 06:22:11 +03:00
File.deleteOnExit is not recursive. Replaced by DeleteFilesOnShutdown shutdown hook. Fixes #2971
This commit is contained in:
@ -32,6 +32,7 @@ import cc.arduino.contributions.packages.ContributionInstaller;
|
||||
import cc.arduino.contributions.packages.ContributionsIndexer;
|
||||
import cc.arduino.contributions.DownloadableContributionVersionComparator;
|
||||
import cc.arduino.contributions.packages.ui.ContributionManagerUI;
|
||||
import cc.arduino.files.DeleteFilesOnShutdown;
|
||||
import cc.arduino.packages.DiscoveryManager;
|
||||
import cc.arduino.utils.Progress;
|
||||
import cc.arduino.view.SplashScreenHelper;
|
||||
@ -127,6 +128,8 @@ public class Base {
|
||||
}
|
||||
|
||||
static public void guardedMain(String args[]) throws Exception {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE));
|
||||
|
||||
BaseNoGui.initLogger();
|
||||
|
||||
BaseNoGui.notifier = new GUIUserNotifier();
|
||||
@ -202,7 +205,7 @@ public class Base {
|
||||
|
||||
// Create a location for untitled sketches
|
||||
untitledFolder = createTempFolder("untitled");
|
||||
untitledFolder.deleteOnExit();
|
||||
DeleteFilesOnShutdown.add(untitledFolder);
|
||||
|
||||
new Base(args);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package processing.app;
|
||||
|
||||
import cc.arduino.files.DeleteFilesOnShutdown;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
import java.io.File;
|
||||
@ -33,19 +35,19 @@ class EditorConsoleStream extends OutputStream {
|
||||
// The files and folders are not deleted on exit because they may be
|
||||
// needed for debugging or bug reporting.
|
||||
tempFolder = Base.createTempFolder("console");
|
||||
tempFolder.deleteOnExit();
|
||||
DeleteFilesOnShutdown.add(tempFolder);
|
||||
try {
|
||||
String outFileName = Preferences.get("console.output.file");
|
||||
if (outFileName != null) {
|
||||
outFile = new File(tempFolder, outFileName);
|
||||
outFile.deleteOnExit();
|
||||
DeleteFilesOnShutdown.add(outFile);
|
||||
stdoutFile = new FileOutputStream(outFile);
|
||||
}
|
||||
|
||||
String errFileName = Preferences.get("console.error.file");
|
||||
if (errFileName != null) {
|
||||
errFile = new File(tempFolder, errFileName);
|
||||
errFile.deleteOnExit();
|
||||
DeleteFilesOnShutdown.add(errFile);
|
||||
stderrFile = new FileOutputStream(errFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
Reference in New Issue
Block a user