mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Refactored Base.getDefaultSketchbookFolder() method.
This commit is contained in:
parent
20582630a5
commit
26a8b37d18
@ -222,7 +222,7 @@ public class Base {
|
|||||||
|
|
||||||
// If no path is set, get the default sketchbook folder for this platform
|
// If no path is set, get the default sketchbook folder for this platform
|
||||||
if (sketchbookPath == null) {
|
if (sketchbookPath == null) {
|
||||||
File defaultFolder = getDefaultSketchbookFolder();
|
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
|
||||||
if (BaseNoGui.getPortableFolder() != null)
|
if (BaseNoGui.getPortableFolder() != null)
|
||||||
Preferences.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
|
Preferences.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
|
||||||
else
|
else
|
||||||
@ -1896,6 +1896,14 @@ public class Base {
|
|||||||
sketchbookFolder = getPlatform().getDefaultSketchbookFolder();
|
sketchbookFolder = getPlatform().getDefaultSketchbookFolder();
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) { }
|
||||||
|
|
||||||
|
return sketchbookFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected File getDefaultSketchbookFolderOrPromptForIt() {
|
||||||
|
|
||||||
|
File sketchbookFolder = getDefaultSketchbookFolder();
|
||||||
|
|
||||||
if (sketchbookFolder == null) {
|
if (sketchbookFolder == null) {
|
||||||
sketchbookFolder = promptSketchbookLocation();
|
sketchbookFolder = promptSketchbookLocation();
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ public class Preferences {
|
|||||||
String newPath = sketchbookLocationField.getText();
|
String newPath = sketchbookLocationField.getText();
|
||||||
if (newPath.isEmpty()) {
|
if (newPath.isEmpty()) {
|
||||||
if (Base.getPortableFolder() == null)
|
if (Base.getPortableFolder() == null)
|
||||||
newPath = editor.base.getDefaultSketchbookFolder().toString();
|
newPath = editor.base.getDefaultSketchbookFolderOrPromptForIt().toString();
|
||||||
else
|
else
|
||||||
newPath = Base.getPortableSketchbookFolder();
|
newPath = Base.getPortableSketchbookFolder();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user