mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Moved getAvrBasePath() and related methods from Base to BaseNoGui (work in progress).
This commit is contained in:
parent
057106f1b9
commit
118826e855
@ -2096,10 +2096,7 @@ public class Base {
|
||||
|
||||
|
||||
static public File getHardwareFolder() {
|
||||
// calculate on the fly because it's needed by Preferences.init() to find
|
||||
// the boards.txt and programmers.txt preferences files (which happens
|
||||
// before the other folders / paths get cached).
|
||||
return getContentFile("hardware");
|
||||
return BaseNoGui.getHardwareFolder();
|
||||
}
|
||||
|
||||
//Get the core libraries
|
||||
@ -2108,17 +2105,12 @@ public class Base {
|
||||
}
|
||||
|
||||
static public String getHardwarePath() {
|
||||
return getHardwareFolder().getAbsolutePath();
|
||||
return BaseNoGui.getHardwarePath();
|
||||
}
|
||||
|
||||
|
||||
static public String getAvrBasePath() {
|
||||
String path = getHardwarePath() + File.separator + "tools" +
|
||||
File.separator + "avr" + File.separator + "bin" + File.separator;
|
||||
if (OSUtils.isLinux() && !(new File(path)).exists()) {
|
||||
return ""; // use distribution provided avr tools if bundled tools missing
|
||||
}
|
||||
return path;
|
||||
return BaseNoGui.getAvrBasePath();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2666,19 +2658,7 @@ public class Base {
|
||||
*/
|
||||
|
||||
static public File getContentFile(String name) {
|
||||
String path = System.getProperty("user.dir");
|
||||
|
||||
// Get a path to somewhere inside the .app folder
|
||||
if (OSUtils.isMacOS()) {
|
||||
// <key>javaroot</key>
|
||||
// <string>$JAVAROOT</string>
|
||||
String javaroot = System.getProperty("javaroot");
|
||||
if (javaroot != null) {
|
||||
path = javaroot;
|
||||
}
|
||||
}
|
||||
File working = new File(path);
|
||||
return new File(working, name);
|
||||
return BaseNoGui.getContentFile(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
package processing.app;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import processing.app.helpers.OSUtils;
|
||||
|
||||
public class BaseNoGui {
|
||||
|
||||
public static final int REVISION = 158;
|
||||
@ -8,4 +12,40 @@ public class BaseNoGui {
|
||||
/** Set true if this a proper release rather than a numbered revision. */
|
||||
static public boolean RELEASE = false;
|
||||
|
||||
static public String getAvrBasePath() {
|
||||
String path = getHardwarePath() + File.separator + "tools" +
|
||||
File.separator + "avr" + File.separator + "bin" + File.separator;
|
||||
if (OSUtils.isLinux() && !(new File(path)).exists()) {
|
||||
return ""; // use distribution provided avr tools if bundled tools missing
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static public File getContentFile(String name) {
|
||||
String path = System.getProperty("user.dir");
|
||||
|
||||
// Get a path to somewhere inside the .app folder
|
||||
if (OSUtils.isMacOS()) {
|
||||
// <key>javaroot</key>
|
||||
// <string>$JAVAROOT</string>
|
||||
String javaroot = System.getProperty("javaroot");
|
||||
if (javaroot != null) {
|
||||
path = javaroot;
|
||||
}
|
||||
}
|
||||
File working = new File(path);
|
||||
return new File(working, name);
|
||||
}
|
||||
|
||||
static public File getHardwareFolder() {
|
||||
// calculate on the fly because it's needed by Preferences.init() to find
|
||||
// the boards.txt and programmers.txt preferences files (which happens
|
||||
// before the other folders / paths get cached).
|
||||
return getContentFile("hardware");
|
||||
}
|
||||
|
||||
static public String getHardwarePath() {
|
||||
return getHardwareFolder().getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class Compiler implements MessageConsumer {
|
||||
// point.
|
||||
if (!p.containsKey("compiler.path")) {
|
||||
System.err.println(_("Third-party platform.txt does not define compiler.path. Please report this to the third-party hardware maintainer."));
|
||||
p.put("compiler.path", Base.getAvrBasePath());
|
||||
p.put("compiler.path", BaseNoGui.getAvrBasePath());
|
||||
}
|
||||
|
||||
// Core folder
|
||||
|
Loading…
x
Reference in New Issue
Block a user