@@ -67,8 +67,6 @@ public class Base {
67
67
/** Set true if this a proper release rather than a numbered revision. */
68
68
static public boolean RELEASE = BaseNoGui .RELEASE ;
69
69
70
- static Platform platform ;
71
-
72
70
private static DiscoveryManager discoveryManager = new DiscoveryManager ();
73
71
74
72
static private boolean commandLine ;
@@ -212,7 +210,7 @@ static public void main(String args[]) throws Exception {
212
210
213
211
// Set the look and feel before opening the window
214
212
try {
215
- platform .setLookAndFeel ();
213
+ BaseNoGui . getPlatform () .setLookAndFeel ();
216
214
} catch (Exception e ) {
217
215
String mess = e .getMessage ();
218
216
if (mess .indexOf ("ch.randelshofer.quaqua.QuaquaLookAndFeel" ) == -1 ) {
@@ -241,21 +239,7 @@ static protected boolean isCommandLine() {
241
239
242
240
243
241
static protected void initPlatform () {
244
- try {
245
- Class <?> platformClass = Class .forName ("processing.app.Platform" );
246
- if (OSUtils .isMacOS ()) {
247
- platformClass = Class .forName ("processing.app.macosx.Platform" );
248
- } else if (OSUtils .isWindows ()) {
249
- platformClass = Class .forName ("processing.app.windows.Platform" );
250
- } else if (OSUtils .isLinux ()) {
251
- platformClass = Class .forName ("processing.app.linux.Platform" );
252
- }
253
- platform = (Platform ) platformClass .newInstance ();
254
- } catch (Exception e ) {
255
- Base .showError (_ ("Problem Setting the Platform" ),
256
- _ ("An unknown error occurred while trying to load\n " +
257
- "platform-specific code for your machine." ), e );
258
- }
242
+ BaseNoGui .initPlatform ();
259
243
}
260
244
261
245
@@ -282,7 +266,7 @@ static public File absoluteFile(String path) {
282
266
protected static enum ACTION { GUI , NOOP , VERIFY , UPLOAD , GET_PREF };
283
267
284
268
public Base (String [] args ) throws Exception {
285
- platform .init (this );
269
+ BaseNoGui . getPlatform () .init (this );
286
270
287
271
// Get the sketchbook path, and make sure it's set properly
288
272
String sketchbookPath = Preferences .get ("sketchbook.path" );
@@ -1919,7 +1903,7 @@ public void handlePrefs() {
1919
1903
1920
1904
1921
1905
static public Platform getPlatform () {
1922
- return platform ;
1906
+ return BaseNoGui . getPlatform () ;
1923
1907
}
1924
1908
1925
1909
@@ -1956,7 +1940,7 @@ static public File getSettingsFolder() {
1956
1940
1957
1941
} else {
1958
1942
try {
1959
- settingsFolder = platform .getSettingsFolder ();
1943
+ settingsFolder = BaseNoGui . getPlatform () .getSettingsFolder ();
1960
1944
} catch (Exception e ) {
1961
1945
showError (_ ("Problem getting data folder" ),
1962
1946
_ ("Error getting the Arduino data folder." ), e );
@@ -2176,7 +2160,7 @@ protected File getDefaultSketchbookFolder() {
2176
2160
2177
2161
File sketchbookFolder = null ;
2178
2162
try {
2179
- sketchbookFolder = platform .getDefaultSketchbookFolder ();
2163
+ sketchbookFolder = BaseNoGui . getPlatform () .getDefaultSketchbookFolder ();
2180
2164
} catch (Exception e ) { }
2181
2165
2182
2166
if (sketchbookFolder == null ) {
@@ -2232,7 +2216,7 @@ static protected File promptSketchbookLocation() {
2232
2216
*/
2233
2217
static public void openURL (String url ) {
2234
2218
try {
2235
- platform .openURL (url );
2219
+ BaseNoGui . getPlatform () .openURL (url );
2236
2220
2237
2221
} catch (Exception e ) {
2238
2222
showWarning (_ ("Problem Opening URL" ),
@@ -2246,7 +2230,7 @@ static public void openURL(String url) {
2246
2230
* @return true If a means of opening a folder is known to be available.
2247
2231
*/
2248
2232
static protected boolean openFolderAvailable () {
2249
- return platform .openFolderAvailable ();
2233
+ return BaseNoGui . getPlatform () .openFolderAvailable ();
2250
2234
}
2251
2235
2252
2236
@@ -2256,7 +2240,7 @@ static protected boolean openFolderAvailable() {
2256
2240
*/
2257
2241
static public void openFolder (File file ) {
2258
2242
try {
2259
- platform .openFolder (file );
2243
+ BaseNoGui . getPlatform () .openFolder (file );
2260
2244
2261
2245
} catch (Exception e ) {
2262
2246
showWarning (_ ("Problem Opening Folder" ),
0 commit comments