mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Moved packages, currentDirectory and portableFolder (and related methods) from Base to BaseNoGui (work in progress).
This commit is contained in:
parent
118826e855
commit
7776ffac4f
@ -32,7 +32,7 @@ package cc.arduino.packages.discoverers;
|
|||||||
import cc.arduino.packages.BoardPort;
|
import cc.arduino.packages.BoardPort;
|
||||||
import cc.arduino.packages.Discovery;
|
import cc.arduino.packages.Discovery;
|
||||||
import cc.arduino.packages.discoverers.network.*;
|
import cc.arduino.packages.discoverers.network.*;
|
||||||
import processing.app.Base;
|
import processing.app.BaseNoGui;
|
||||||
import processing.app.helpers.NetUtils;
|
import processing.app.helpers.NetUtils;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.zeroconf.jmdns.ArduinoDNSTaskStarter;
|
import processing.app.zeroconf.jmdns.ArduinoDNSTaskStarter;
|
||||||
@ -140,7 +140,7 @@ public class NetworkDiscovery implements Discovery, ServiceListener, cc.arduino.
|
|||||||
|
|
||||||
String label = name + " at " + address;
|
String label = name + " at " + address;
|
||||||
if (board != null) {
|
if (board != null) {
|
||||||
String boardName = Base.getPlatform().resolveDeviceByBoardID(Base.packages, board);
|
String boardName = Base.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board);
|
||||||
label += " (" + boardName + ")";
|
label += " (" + boardName + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ package cc.arduino.packages.discoverers;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import processing.app.Base;
|
import processing.app.BaseNoGui;
|
||||||
import processing.app.Platform;
|
import processing.app.Platform;
|
||||||
import processing.app.Serial;
|
import processing.app.Serial;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
@ -51,7 +51,7 @@ public class SerialDiscovery implements Discovery {
|
|||||||
List<String> ports = Serial.list();
|
List<String> ports = Serial.list();
|
||||||
|
|
||||||
for (String port : ports) {
|
for (String port : ports) {
|
||||||
String boardName = os.resolveDeviceAttachedTo(port, Base.packages, devicesListOutput);
|
String boardName = os.resolveDeviceAttachedTo(port, BaseNoGui.packages, devicesListOutput);
|
||||||
String label = port;
|
String label = port;
|
||||||
if (boardName != null)
|
if (boardName != null)
|
||||||
label += " (" + boardName + ")";
|
label += " (" + boardName + ")";
|
||||||
|
@ -40,7 +40,6 @@ import cc.arduino.packages.DiscoveryManager;
|
|||||||
import processing.app.debug.TargetBoard;
|
import processing.app.debug.TargetBoard;
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.debug.TargetPlatformException;
|
|
||||||
import processing.app.helpers.FileUtils;
|
import processing.app.helpers.FileUtils;
|
||||||
import processing.app.helpers.OSUtils;
|
import processing.app.helpers.OSUtils;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
@ -100,14 +99,12 @@ public class Base {
|
|||||||
// found in the sketchbook)
|
// found in the sketchbook)
|
||||||
static public String librariesClassPath;
|
static public String librariesClassPath;
|
||||||
|
|
||||||
static public Map<String, TargetPackage> packages;
|
|
||||||
|
|
||||||
// Location for untitled items
|
// Location for untitled items
|
||||||
static File untitledFolder;
|
static File untitledFolder;
|
||||||
|
|
||||||
// Current directory to use for relative paths specified on the
|
// Current directory to use for relative paths specified on the
|
||||||
// commandline
|
// commandline
|
||||||
static String currentDirectory = System.getProperty("user.dir");
|
static String currentDirectory = BaseNoGui.currentDirectory;
|
||||||
|
|
||||||
// p5 icon for the window
|
// p5 icon for the window
|
||||||
// static Image icon;
|
// static Image icon;
|
||||||
@ -116,7 +113,6 @@ public class Base {
|
|||||||
List<Editor> editors = Collections.synchronizedList(new ArrayList<Editor>());
|
List<Editor> editors = Collections.synchronizedList(new ArrayList<Editor>());
|
||||||
Editor activeEditor;
|
Editor activeEditor;
|
||||||
|
|
||||||
static File portableFolder = null;
|
|
||||||
static final String portableSketchbookFolder = "sketchbook";
|
static final String portableSketchbookFolder = "sketchbook";
|
||||||
|
|
||||||
static public void main(String args[]) throws Exception {
|
static public void main(String args[]) throws Exception {
|
||||||
@ -125,10 +121,7 @@ public class Base {
|
|||||||
|
|
||||||
initPlatform();
|
initPlatform();
|
||||||
|
|
||||||
// Portable folder
|
BaseNoGui.initPortableFolder();
|
||||||
portableFolder = getContentFile("portable");
|
|
||||||
if (!portableFolder.exists())
|
|
||||||
portableFolder = null;
|
|
||||||
|
|
||||||
String preferencesFile = null;
|
String preferencesFile = null;
|
||||||
|
|
||||||
@ -283,13 +276,7 @@ public class Base {
|
|||||||
// directory when starting the IDE (which is not the same as the
|
// directory when starting the IDE (which is not the same as the
|
||||||
// current working directory!).
|
// current working directory!).
|
||||||
static public File absoluteFile(String path) {
|
static public File absoluteFile(String path) {
|
||||||
if (path == null) return null;
|
return BaseNoGui.absoluteFile(path);
|
||||||
|
|
||||||
File file = new File(path);
|
|
||||||
if (!file.isAbsolute()) {
|
|
||||||
file = new File(currentDirectory, path);
|
|
||||||
}
|
|
||||||
return file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static enum ACTION { GUI, NOOP, VERIFY, UPLOAD, GET_PREF };
|
protected static enum ACTION { GUI, NOOP, VERIFY, UPLOAD, GET_PREF };
|
||||||
@ -304,8 +291,8 @@ public class Base {
|
|||||||
// 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 (portableFolder != null)
|
if (BaseNoGui.getPortableFolder() != null)
|
||||||
sketchbookFolder = new File(portableFolder, sketchbookPath);
|
sketchbookFolder = new File(BaseNoGui.getPortableFolder(), sketchbookPath);
|
||||||
else
|
else
|
||||||
sketchbookFolder = Base.absoluteFile(sketchbookPath);
|
sketchbookFolder = Base.absoluteFile(sketchbookPath);
|
||||||
if (!sketchbookFolder.exists()) {
|
if (!sketchbookFolder.exists()) {
|
||||||
@ -322,7 +309,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 = getDefaultSketchbookFolder();
|
||||||
if (portableFolder != null)
|
if (BaseNoGui.getPortableFolder() != null)
|
||||||
Preferences.set("sketchbook.path", portableSketchbookFolder);
|
Preferences.set("sketchbook.path", portableSketchbookFolder);
|
||||||
else
|
else
|
||||||
Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
|
Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
|
||||||
@ -331,13 +318,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packages = new HashMap<String, TargetPackage>();
|
BaseNoGui.initPackages();
|
||||||
loadHardware(getHardwareFolder());
|
|
||||||
loadHardware(getSketchbookHardwareFolder());
|
|
||||||
if (packages.size() == 0) {
|
|
||||||
System.out.println(_("No valid configured cores found! Exiting..."));
|
|
||||||
System.exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup board-dependent variables.
|
// Setup board-dependent variables.
|
||||||
onBoardOrPortChange();
|
onBoardOrPortChange();
|
||||||
@ -643,8 +624,8 @@ public class Base {
|
|||||||
int opened = 0;
|
int opened = 0;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
String path = Preferences.get("last.sketch" + i + ".path");
|
String path = Preferences.get("last.sketch" + i + ".path");
|
||||||
if (portableFolder != null) {
|
if (BaseNoGui.getPortableFolder() != null) {
|
||||||
File absolute = new File(portableFolder, path);
|
File absolute = new File(BaseNoGui.getPortableFolder(), path);
|
||||||
try {
|
try {
|
||||||
path = absolute.getCanonicalPath();
|
path = absolute.getCanonicalPath();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -689,8 +670,8 @@ public class Base {
|
|||||||
!editor.getSketch().isModified()) {
|
!editor.getSketch().isModified()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (portableFolder != null) {
|
if (BaseNoGui.getPortableFolder() != null) {
|
||||||
path = FileUtils.relativePath(portableFolder.toString(), path);
|
path = FileUtils.relativePath(BaseNoGui.getPortableFolder().toString(), path);
|
||||||
if (path == null)
|
if (path == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -713,8 +694,8 @@ public class Base {
|
|||||||
if (path.startsWith(untitledPath)) {
|
if (path.startsWith(untitledPath)) {
|
||||||
path = "";
|
path = "";
|
||||||
} else
|
} else
|
||||||
if (portableFolder != null) {
|
if (BaseNoGui.getPortableFolder() != null) {
|
||||||
path = FileUtils.relativePath(portableFolder.toString(), path);
|
path = FileUtils.relativePath(BaseNoGui.getPortableFolder().toString(), path);
|
||||||
if (path == null)
|
if (path == null)
|
||||||
path = "";
|
path = "";
|
||||||
}
|
}
|
||||||
@ -1456,7 +1437,7 @@ public class Base {
|
|||||||
|
|
||||||
// Generate custom menus for all platforms
|
// Generate custom menus for all platforms
|
||||||
Set<String> titles = new HashSet<String>();
|
Set<String> titles = new HashSet<String>();
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms())
|
for (TargetPlatform targetPlatform : targetPackage.platforms())
|
||||||
titles.addAll(targetPlatform.getCustomMenus().values());
|
titles.addAll(targetPlatform.getCustomMenus().values());
|
||||||
}
|
}
|
||||||
@ -1464,7 +1445,7 @@ public class Base {
|
|||||||
makeBoardCustomMenu(toolsMenu, _(title));
|
makeBoardCustomMenu(toolsMenu, _(title));
|
||||||
|
|
||||||
// Cycle through all packages
|
// Cycle through all packages
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
|
||||||
// For every package cycle through all platform
|
// For every package cycle through all platform
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
|
|
||||||
@ -1674,7 +1655,7 @@ public class Base {
|
|||||||
public void rebuildProgrammerMenu(JMenu menu) {
|
public void rebuildProgrammerMenu(JMenu menu) {
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
||||||
String id = targetPackage.getId() + ":" + programmer;
|
String id = targetPackage.getId() + ":" + programmer;
|
||||||
@ -1860,30 +1841,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void loadHardware(File folder) {
|
protected void loadHardware(File folder) {
|
||||||
if (!folder.isDirectory()) return;
|
BaseNoGui.loadHardware(folder);
|
||||||
|
|
||||||
String list[] = folder.list(new OnlyDirs());
|
|
||||||
|
|
||||||
// if a bad folder or something like that, this might come back null
|
|
||||||
if (list == null) return;
|
|
||||||
|
|
||||||
// alphabetize list, since it's not always alpha order
|
|
||||||
// replaced hella slow bubble sort with this feller for 0093
|
|
||||||
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
for (String target : list) {
|
|
||||||
// Skip reserved 'tools' folder.
|
|
||||||
if (target.equals("tools"))
|
|
||||||
continue;
|
|
||||||
File subfolder = new File(folder, target);
|
|
||||||
|
|
||||||
try {
|
|
||||||
packages.put(target, new TargetPackage(target, subfolder));
|
|
||||||
} catch (TargetPlatformException e) {
|
|
||||||
System.out.println("WARNING: Error loading hardware folder " + target);
|
|
||||||
System.out.println(" " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1987,8 +1945,8 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
static public File getSettingsFolder() {
|
static public File getSettingsFolder() {
|
||||||
if (portableFolder != null)
|
if (BaseNoGui.getPortableFolder() != null)
|
||||||
return portableFolder;
|
return BaseNoGui.getPortableFolder();
|
||||||
|
|
||||||
File settingsFolder = null;
|
File settingsFolder = null;
|
||||||
|
|
||||||
@ -2120,7 +2078,7 @@ public class Base {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static public TargetPackage getTargetPackage(String packageName) {
|
static public TargetPackage getTargetPackage(String packageName) {
|
||||||
return packages.get(packageName);
|
return BaseNoGui.packages.get(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2129,9 +2087,7 @@ public class Base {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static public TargetPlatform getTargetPlatform() {
|
static public TargetPlatform getTargetPlatform() {
|
||||||
String packageName = Preferences.get("target_package");
|
return BaseNoGui.getTargetPlatform();
|
||||||
String platformName = Preferences.get("target_platform");
|
|
||||||
return getTargetPlatform(packageName, platformName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2143,10 +2099,7 @@ public class Base {
|
|||||||
*/
|
*/
|
||||||
static public TargetPlatform getTargetPlatform(String packageName,
|
static public TargetPlatform getTargetPlatform(String packageName,
|
||||||
String platformName) {
|
String platformName) {
|
||||||
TargetPackage p = packages.get(packageName);
|
return BaseNoGui.getTargetPlatform(packageName, platformName);
|
||||||
if (p == null)
|
|
||||||
return null;
|
|
||||||
return p.get(platformName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
|
static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
|
||||||
@ -2176,7 +2129,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public File getPortableFolder() {
|
static public File getPortableFolder() {
|
||||||
return portableFolder;
|
return BaseNoGui.getPortableFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2186,9 +2139,7 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
static public File getSketchbookFolder() {
|
static public File getSketchbookFolder() {
|
||||||
if (portableFolder != null)
|
return BaseNoGui.getSketchbookFolder();
|
||||||
return new File(portableFolder, Preferences.get("sketchbook.path"));
|
|
||||||
return absoluteFile(Preferences.get("sketchbook.path"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2215,13 +2166,13 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
static public File getSketchbookHardwareFolder() {
|
static public File getSketchbookHardwareFolder() {
|
||||||
return new File(getSketchbookFolder(), "hardware");
|
return BaseNoGui.getSketchbookHardwareFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected File getDefaultSketchbookFolder() {
|
protected File getDefaultSketchbookFolder() {
|
||||||
if (portableFolder != null)
|
if (BaseNoGui.getPortableFolder() != null)
|
||||||
return new File(portableFolder, portableSketchbookFolder);
|
return new File(BaseNoGui.getPortableFolder(), portableSketchbookFolder);
|
||||||
|
|
||||||
File sketchbookFolder = null;
|
File sketchbookFolder = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
package processing.app;
|
package processing.app;
|
||||||
|
|
||||||
import java.io.File;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import processing.app.debug.TargetPackage;
|
||||||
|
import processing.app.debug.TargetPlatform;
|
||||||
|
import processing.app.debug.TargetPlatformException;
|
||||||
import processing.app.helpers.OSUtils;
|
import processing.app.helpers.OSUtils;
|
||||||
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
|
|
||||||
public class BaseNoGui {
|
public class BaseNoGui {
|
||||||
|
|
||||||
@ -12,6 +21,28 @@ public class BaseNoGui {
|
|||||||
/** Set true if this a proper release rather than a numbered revision. */
|
/** Set true if this a proper release rather than a numbered revision. */
|
||||||
static public boolean RELEASE = false;
|
static public boolean RELEASE = false;
|
||||||
|
|
||||||
|
// Current directory to use for relative paths specified on the
|
||||||
|
// commandline
|
||||||
|
static String currentDirectory = System.getProperty("user.dir");
|
||||||
|
|
||||||
|
static public Map<String, TargetPackage> packages;
|
||||||
|
|
||||||
|
static File portableFolder = null;
|
||||||
|
|
||||||
|
// Returns a File object for the given pathname. If the pathname
|
||||||
|
// is not absolute, it is interpreted relative to the current
|
||||||
|
// directory when starting the IDE (which is not the same as the
|
||||||
|
// current working directory!).
|
||||||
|
static public File absoluteFile(String path) {
|
||||||
|
if (path == null) return null;
|
||||||
|
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.isAbsolute()) {
|
||||||
|
file = new File(currentDirectory, path);
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
static public String getAvrBasePath() {
|
static public String getAvrBasePath() {
|
||||||
String path = getHardwarePath() + File.separator + "tools" +
|
String path = getHardwarePath() + File.separator + "tools" +
|
||||||
File.separator + "avr" + File.separator + "bin" + File.separator;
|
File.separator + "avr" + File.separator + "bin" + File.separator;
|
||||||
@ -48,4 +79,88 @@ public class BaseNoGui {
|
|||||||
return getHardwareFolder().getAbsolutePath();
|
return getHardwareFolder().getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public File getPortableFolder() {
|
||||||
|
return portableFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public File getSketchbookFolder() {
|
||||||
|
if (portableFolder != null)
|
||||||
|
return new File(portableFolder, Preferences.get("sketchbook.path"));
|
||||||
|
return absoluteFile(Preferences.get("sketchbook.path"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static public File getSketchbookHardwareFolder() {
|
||||||
|
return new File(getSketchbookFolder(), "hardware");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently selected TargetPlatform.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static public TargetPlatform getTargetPlatform() {
|
||||||
|
String packageName = Preferences.get("target_package");
|
||||||
|
String platformName = Preferences.get("target_platform");
|
||||||
|
return getTargetPlatform(packageName, platformName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a specific TargetPlatform searching Package/Platform
|
||||||
|
*
|
||||||
|
* @param packageName
|
||||||
|
* @param platformName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static public TargetPlatform getTargetPlatform(String packageName,
|
||||||
|
String platformName) {
|
||||||
|
TargetPackage p = packages.get(packageName);
|
||||||
|
if (p == null)
|
||||||
|
return null;
|
||||||
|
return p.get(platformName);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void initPackages() {
|
||||||
|
packages = new HashMap<String, TargetPackage>();
|
||||||
|
loadHardware(getHardwareFolder());
|
||||||
|
loadHardware(getSketchbookHardwareFolder());
|
||||||
|
if (packages.size() == 0) {
|
||||||
|
System.out.println(_("No valid configured cores found! Exiting..."));
|
||||||
|
System.exit(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void initPortableFolder() {
|
||||||
|
// Portable folder
|
||||||
|
portableFolder = getContentFile("portable");
|
||||||
|
if (!portableFolder.exists())
|
||||||
|
portableFolder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static protected void loadHardware(File folder) {
|
||||||
|
if (!folder.isDirectory()) return;
|
||||||
|
|
||||||
|
String list[] = folder.list(new OnlyDirs());
|
||||||
|
|
||||||
|
// if a bad folder or something like that, this might come back null
|
||||||
|
if (list == null) return;
|
||||||
|
|
||||||
|
// alphabetize list, since it's not always alpha order
|
||||||
|
// replaced hella slow bubble sort with this feller for 0093
|
||||||
|
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
|
for (String target : list) {
|
||||||
|
// Skip reserved 'tools' folder.
|
||||||
|
if (target.equals("tools"))
|
||||||
|
continue;
|
||||||
|
File subfolder = new File(folder, target);
|
||||||
|
|
||||||
|
try {
|
||||||
|
BaseNoGui.packages.put(target, new TargetPackage(target, subfolder));
|
||||||
|
} catch (TargetPlatformException e) {
|
||||||
|
System.out.println("WARNING: Error loading hardware folder " + target);
|
||||||
|
System.out.println(" " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
List<String> archs = new ArrayList<String>();
|
List<String> archs = new ArrayList<String>();
|
||||||
archs.add(Base.getTargetPlatform().getId());
|
archs.add(BaseNoGui.getTargetPlatform().getId());
|
||||||
if (prefs.containsKey("architecture.override_check")) {
|
if (prefs.containsKey("architecture.override_check")) {
|
||||||
String[] overrides = prefs.get("architecture.override_check").split(",");
|
String[] overrides = prefs.get("architecture.override_check").split(",");
|
||||||
archs.addAll(Arrays.asList(overrides));
|
archs.addAll(Arrays.asList(overrides));
|
||||||
@ -186,7 +186,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the board needs a platform from another package
|
// Check if the board needs a platform from another package
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
|
||||||
TargetPlatform corePlatform = null;
|
TargetPlatform corePlatform = null;
|
||||||
PreferencesMap boardPreferences = Base.getBoardPreferences();
|
PreferencesMap boardPreferences = Base.getBoardPreferences();
|
||||||
String core = boardPreferences.get("build.core");
|
String core = boardPreferences.get("build.core");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user