Skip to content

Commit

Permalink
Removed duplicate version fields in Base class
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Nov 18, 2014
1 parent 13fd277 commit b0bd52b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 37 deletions.
9 changes: 1 addition & 8 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
* files and images, etc) that comes from that.
*/
public class Base {
public static final int REVISION = BaseNoGui.REVISION;
/** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = BaseNoGui.VERSION_NAME;
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = BaseNoGui.RELEASE;

static private boolean commandLine;

Expand Down Expand Up @@ -104,8 +99,6 @@ static public void main(String args[]) throws Exception {
BaseNoGui.initParameters(args);

BaseNoGui.initVersion();
VERSION_NAME = BaseNoGui.VERSION_NAME;
RELEASE = BaseNoGui.RELEASE;

// if (System.getProperty("mrj.version") != null) {
// //String jv = System.getProperty("java.version");
Expand Down Expand Up @@ -1509,7 +1502,7 @@ public void paint(Graphics g) {

g.setFont(new Font("SansSerif", Font.PLAIN, 11));
g.setColor(Color.white);
g.drawString(VERSION_NAME, 50, 30);
g.drawString(BaseNoGui.VERSION_NAME, 50, 30);
}
};
window.addMouseListener(new MouseAdapter() {
Expand Down
9 changes: 2 additions & 7 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2208,13 +2208,8 @@ protected boolean handleOpenInternal(File sketchFile) {
}
header.rebuild();
// Set the title of the window to "sketch_070752a - Processing 0126"
setTitle(
I18n.format(
_("{0} | Arduino {1}"),
sketch.getName(),
Base.VERSION_NAME
)
);
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(),
BaseNoGui.VERSION_NAME));
// Disable untitled setting from previous document, if any
untitled = false;

Expand Down
2 changes: 1 addition & 1 deletion app/src/processing/app/EditorStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void keyTyped(KeyEvent event) {
copyErrorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String message = "";
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Arduino: ") + BaseNoGui.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n\n";
message += editor.console.consoleTextPane.getText().trim();
if ((Preferences.getBoolean("build.verbose")) == false) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/processing/app/UpdateCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void run() {
try {
String info;
info = URLEncoder.encode(id + "\t" +
PApplet.nf(Base.REVISION, 4) + "\t" +
PApplet.nf(BaseNoGui.REVISION, 4) + "\t" +
System.getProperty("java.version") + "\t" +
System.getProperty("java.vendor") + "\t" +
System.getProperty("os.name") + "\t" +
Expand All @@ -104,7 +104,7 @@ public void run() {
"would you like to visit the Arduino download page?");

if (base.activeEditor != null) {
if (latest > Base.REVISION) {
if (latest > BaseNoGui.REVISION) {
Object[] options = { _("Yes"), _("No") };
int result = JOptionPane.showOptionDialog(base.activeEditor,
prompt,
Expand Down
20 changes: 3 additions & 17 deletions arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@

public class BaseNoGui {

/** Version string to be used for build */
public static final int REVISION = 158;
/** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = "0158";
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = false;
/** Extended version string displayed on GUI */
static String VERSION_NAME = "1.5.8";

static File buildFolder;

Expand Down Expand Up @@ -608,19 +607,6 @@ static public void initPortableFolder() {
}

static public void initVersion() {
try {
File versionFile = getContentFile("lib/version.txt");
if (versionFile.exists()) {
String version = PApplet.loadStrings(versionFile)[0];
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
VERSION_NAME = version;
RELEASE = true;
}
}
} catch (Exception e) {
e.printStackTrace();
}

// help 3rd party installers find the correct hardware path
PreferencesData.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
PreferencesData.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);
Expand Down
4 changes: 2 additions & 2 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
<replaceregex pattern=".*&quot;(.*)&quot;.*" flags="g" replace="\1"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo message="Revision in BaseNoGui.java is: ${revision.base}" />
<echo message=" Revision in BaseNoGui.java is: ${revision.base}" />
</target>

<!-- - - - - - - - -->
Expand Down

0 comments on commit b0bd52b

Please sign in to comment.