1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-18 12:54:25 +01:00

Move Sketchbook preparation before Theme.init()

Fixes NPE when searching for themes in portable installation
This commit is contained in:
Martino Facchin 2018-04-17 14:52:29 +02:00 committed by Cristian Maglie
parent 260e0c284c
commit 01519eba9c

View File

@ -209,6 +209,20 @@ public class Base {
parser.parseArgumentsPhase1();
commandLine = !parser.isGuiMode();
BaseNoGui.checkInstallationFolder();
// If no path is set, get the default sketchbook folder for this platform
if (BaseNoGui.getSketchbookPath() == null) {
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
if (BaseNoGui.getPortableFolder() != null)
PreferencesData.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
else
PreferencesData.set("sketchbook.path", defaultFolder.getAbsolutePath());
if (!defaultFolder.exists()) {
defaultFolder.mkdirs();
}
}
SplashScreenHelper splash;
if (parser.isGuiMode()) {
// Setup all notification widgets
@ -243,20 +257,6 @@ public class Base {
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
DeleteFilesOnShutdown.add(untitledFolder);
BaseNoGui.checkInstallationFolder();
// If no path is set, get the default sketchbook folder for this platform
if (BaseNoGui.getSketchbookPath() == null) {
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
if (BaseNoGui.getPortableFolder() != null)
PreferencesData.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
else
PreferencesData.set("sketchbook.path", defaultFolder.getAbsolutePath());
if (!defaultFolder.exists()) {
defaultFolder.mkdirs();
}
}
splash.splashText(tr("Initializing packages..."));
BaseNoGui.initPackages();