mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Moved getDefaultSketchbookFolder() from Base to BaseNoGui and other minor fixes.
This commit is contained in:
parent
26a8b37d18
commit
035e57e909
@ -1887,22 +1887,9 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected File getDefaultSketchbookFolder() {
|
|
||||||
if (BaseNoGui.getPortableFolder() != null)
|
|
||||||
return new File(BaseNoGui.getPortableFolder(), BaseNoGui.getPortableSketchbookFolder());
|
|
||||||
|
|
||||||
File sketchbookFolder = null;
|
|
||||||
try {
|
|
||||||
sketchbookFolder = getPlatform().getDefaultSketchbookFolder();
|
|
||||||
} catch (Exception e) { }
|
|
||||||
|
|
||||||
return sketchbookFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected File getDefaultSketchbookFolderOrPromptForIt() {
|
protected File getDefaultSketchbookFolderOrPromptForIt() {
|
||||||
|
|
||||||
File sketchbookFolder = getDefaultSketchbookFolder();
|
File sketchbookFolder = BaseNoGui.getDefaultSketchbookFolder();
|
||||||
|
|
||||||
if (sketchbookFolder == null) {
|
if (sketchbookFolder == null) {
|
||||||
sketchbookFolder = promptSketchbookLocation();
|
sketchbookFolder = promptSketchbookLocation();
|
||||||
|
@ -143,6 +143,18 @@ public class BaseNoGui {
|
|||||||
return getTargetPlatform(pack, PreferencesData.get("target_platform"));
|
return getTargetPlatform(pack, PreferencesData.get("target_platform"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public File getDefaultSketchbookFolder() {
|
||||||
|
if (getPortableFolder() != null)
|
||||||
|
return new File(getPortableFolder(), getPortableSketchbookFolder());
|
||||||
|
|
||||||
|
File sketchbookFolder = null;
|
||||||
|
try {
|
||||||
|
sketchbookFolder = getPlatform().getDefaultSketchbookFolder();
|
||||||
|
} catch (Exception e) { }
|
||||||
|
|
||||||
|
return sketchbookFolder;
|
||||||
|
}
|
||||||
|
|
||||||
public static DiscoveryManager getDiscoveryManager() {
|
public static DiscoveryManager getDiscoveryManager() {
|
||||||
return discoveryManager;
|
return discoveryManager;
|
||||||
}
|
}
|
||||||
@ -262,14 +274,14 @@ public class BaseNoGui {
|
|||||||
|
|
||||||
static public String getSketchbookPath() {
|
static public String getSketchbookPath() {
|
||||||
// Get the sketchbook path, and make sure it's set properly
|
// Get the sketchbook path, and make sure it's set properly
|
||||||
String sketchbookPath = Preferences.get("sketchbook.path");
|
String sketchbookPath = PreferencesData.get("sketchbook.path");
|
||||||
|
|
||||||
// If a value is at least set, first check to see if the folder exists.
|
// If a value is at least set, first check to see if the folder exists.
|
||||||
// If it doesn't, warn the user that the sketchbook folder is being reset.
|
// If it doesn't, warn the user that the sketchbook folder is being reset.
|
||||||
if (sketchbookPath != null) {
|
if (sketchbookPath != null) {
|
||||||
File sketchbookFolder;
|
File sketchbookFolder;
|
||||||
if (BaseNoGui.getPortableFolder() != null)
|
if (getPortableFolder() != null)
|
||||||
sketchbookFolder = new File(BaseNoGui.getPortableFolder(), sketchbookPath);
|
sketchbookFolder = new File(getPortableFolder(), sketchbookPath);
|
||||||
else
|
else
|
||||||
sketchbookFolder = absoluteFile(sketchbookPath);
|
sketchbookFolder = absoluteFile(sketchbookPath);
|
||||||
if (!sketchbookFolder.exists()) {
|
if (!sketchbookFolder.exists()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user