set DEBUG flag using external file

This commit is contained in:
Ben Fry
2016-11-09 17:23:50 -05:00
parent 1b0e335f9c
commit 6e3c18dd1a
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -44,6 +44,7 @@ import processing.app.tools.Tool;
import processing.app.ui.*;
import processing.core.*;
import processing.data.StringList;
import sun.security.x509.IssuingDistributionPointExtension;
/**
@@ -60,9 +61,12 @@ public class Base {
static private String VERSION_NAME = "0256"; //$NON-NLS-1$
/** Set true if this a proper release rather than a numbered revision. */
/** True if heavy debugging error/log messages are enabled */
static public boolean DEBUG = false;
// static public boolean DEBUG = true;
/**
* True if heavy debugging error/log messages are enabled. Set to true
* if an empty file named 'debug' is found in the settings folder.
* See implementation in createAndShowGUI().
*/
static public boolean DEBUG;
static private boolean commandLine;
@@ -129,7 +133,6 @@ public class Base {
String version = PApplet.loadStrings(versionFile)[0];
if (!version.equals(VERSION_NAME)) {
VERSION_NAME = version;
// RELEASE = true;
}
}
} catch (Exception e) {
@@ -138,6 +141,11 @@ public class Base {
Platform.init();
// Set the debug flag based on a file being present in the settings folder
File debugFile = getSettingsFile("debug");
// if it's a directory, it's a leftover from older releases
DEBUG = debugFile.exists() && !debugFile.isDirectory();
// Use native popups so they don't look so crappy on OS X
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
+1 -1
View File
@@ -335,7 +335,7 @@ public class Messages {
static public void loge(String message) {
if (Base.DEBUG) {
System.out.println(message);
System.err.println(message);
}
}
}