|
28 | 28 | import java.util.*;
|
29 | 29 | import java.util.List;
|
30 | 30 | import java.util.concurrent.ConcurrentHashMap;
|
31 |
| -import java.util.logging.Level; |
32 |
| -import java.util.logging.Logger; |
33 | 31 |
|
34 | 32 | import javax.swing.*;
|
35 | 33 |
|
36 |
| -import org.apache.commons.logging.impl.LogFactoryImpl; |
37 |
| -import org.apache.commons.logging.impl.NoOpLog; |
38 |
| - |
39 | 34 | import cc.arduino.packages.DiscoveryManager;
|
40 | 35 | import processing.app.debug.TargetBoard;
|
41 | 36 | import processing.app.debug.TargetPackage;
|
@@ -108,52 +103,17 @@ public class Base {
|
108 | 103 | static final String portableSketchbookFolder = "sketchbook";
|
109 | 104 |
|
110 | 105 | static public void main(String args[]) throws Exception {
|
111 |
| - System.setProperty(LogFactoryImpl.LOG_PROPERTY, NoOpLog.class.getCanonicalName()); |
112 |
| - Logger.getLogger("javax.jmdns").setLevel(Level.OFF); |
| 106 | + BaseNoGui.initLogger(); |
113 | 107 |
|
114 | 108 | initPlatform();
|
115 | 109 |
|
116 | 110 | BaseNoGui.initPortableFolder();
|
117 | 111 |
|
118 |
| - String preferencesFile = null; |
119 |
| - |
120 |
| - // Do a first pass over the commandline arguments, the rest of them |
121 |
| - // will be processed by the Base constructor. Note that this loop |
122 |
| - // does not look at the last element of args, to prevent crashing |
123 |
| - // when no parameter was specified to an option. Later, Base() will |
124 |
| - // then show an error for these. |
125 |
| - for (int i = 0; i < args.length - 1; i++) { |
126 |
| - if (args[i].equals("--preferences-file")) { |
127 |
| - ++i; |
128 |
| - preferencesFile = args[i]; |
129 |
| - continue; |
130 |
| - } |
131 |
| - if (args[i].equals("--curdir")) { |
132 |
| - i++; |
133 |
| - currentDirectory = args[i]; |
134 |
| - continue; |
135 |
| - } |
136 |
| - } |
137 |
| - |
138 |
| - // run static initialization that grabs all the prefs |
139 |
| - Preferences.init(absoluteFile(preferencesFile)); |
140 |
| - |
141 |
| - try { |
142 |
| - File versionFile = getContentFile("lib/version.txt"); |
143 |
| - if (versionFile.exists()) { |
144 |
| - String version = PApplet.loadStrings(versionFile)[0]; |
145 |
| - if (!version.equals(VERSION_NAME) && !version.equals("${version}")) { |
146 |
| - VERSION_NAME = version; |
147 |
| - RELEASE = true; |
148 |
| - } |
149 |
| - } |
150 |
| - } catch (Exception e) { |
151 |
| - e.printStackTrace(); |
152 |
| - } |
153 |
| - |
154 |
| - // help 3rd party installers find the correct hardware path |
155 |
| - Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath()); |
156 |
| - Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000); |
| 112 | + BaseNoGui.prescanParameters(args); |
| 113 | + |
| 114 | + BaseNoGui.initVersion(); |
| 115 | + VERSION_NAME = BaseNoGui.VERSION_NAME; |
| 116 | + RELEASE = BaseNoGui.RELEASE; |
157 | 117 |
|
158 | 118 | // if (System.getProperty("mrj.version") != null) {
|
159 | 119 | // //String jv = System.getProperty("java.version");
|
@@ -204,7 +164,7 @@ static public void main(String args[]) throws Exception {
|
204 | 164 |
|
205 | 165 | // Set the look and feel before opening the window
|
206 | 166 | try {
|
207 |
| - BaseNoGui.getPlatform().setLookAndFeel(); |
| 167 | + getPlatform().setLookAndFeel(); |
208 | 168 | } catch (Exception e) {
|
209 | 169 | String mess = e.getMessage();
|
210 | 170 | if (mess.indexOf("ch.randelshofer.quaqua.QuaquaLookAndFeel") == -1) {
|
@@ -260,7 +220,7 @@ static public File absoluteFile(String path) {
|
260 | 220 | protected static enum ACTION { GUI, NOOP, VERIFY, UPLOAD, GET_PREF };
|
261 | 221 |
|
262 | 222 | public Base(String[] args) throws Exception {
|
263 |
| - BaseNoGui.getPlatform().init(this); |
| 223 | + getPlatform().init(this); |
264 | 224 |
|
265 | 225 | // Get the sketchbook path, and make sure it's set properly
|
266 | 226 | String sketchbookPath = Preferences.get("sketchbook.path");
|
@@ -1901,7 +1861,7 @@ static public File getSettingsFolder() {
|
1901 | 1861 |
|
1902 | 1862 | } else {
|
1903 | 1863 | try {
|
1904 |
| - settingsFolder = BaseNoGui.getPlatform().getSettingsFolder(); |
| 1864 | + settingsFolder = getPlatform().getSettingsFolder(); |
1905 | 1865 | } catch (Exception e) {
|
1906 | 1866 | showError(_("Problem getting data folder"),
|
1907 | 1867 | _("Error getting the Arduino data folder."), e);
|
@@ -2108,7 +2068,7 @@ protected File getDefaultSketchbookFolder() {
|
2108 | 2068 |
|
2109 | 2069 | File sketchbookFolder = null;
|
2110 | 2070 | try {
|
2111 |
| - sketchbookFolder = BaseNoGui.getPlatform().getDefaultSketchbookFolder(); |
| 2071 | + sketchbookFolder = getPlatform().getDefaultSketchbookFolder(); |
2112 | 2072 | } catch (Exception e) { }
|
2113 | 2073 |
|
2114 | 2074 | if (sketchbookFolder == null) {
|
@@ -2164,7 +2124,7 @@ static protected File promptSketchbookLocation() {
|
2164 | 2124 | */
|
2165 | 2125 | static public void openURL(String url) {
|
2166 | 2126 | try {
|
2167 |
| - BaseNoGui.getPlatform().openURL(url); |
| 2127 | + getPlatform().openURL(url); |
2168 | 2128 |
|
2169 | 2129 | } catch (Exception e) {
|
2170 | 2130 | showWarning(_("Problem Opening URL"),
|
|
0 commit comments