If we're a non-versioned application ignore the version.txt file.

This commit is contained in:
Michael Bayne
2004-08-10 22:28:17 +00:00
parent e5b89948ce
commit 9f268a0ae1
@@ -1,5 +1,5 @@
// //
// $Id: Application.java,v 1.30 2004/08/10 07:26:19 mdb Exp $ // $Id: Application.java,v 1.31 2004/08/10 22:28:17 mdb Exp $
package com.threerings.getdown.data; package com.threerings.getdown.data;
@@ -137,7 +137,7 @@ public class Application
{ {
if (_targetVersion <= _version) { if (_targetVersion <= _version) {
Log.warning("Requested patch resource for up-to-date or " + Log.warning("Requested patch resource for up-to-date or " +
"non-versioned appliation [cvers=" + _version + "non-versioned application [cvers=" + _version +
", tvers=" + _targetVersion + "]."); ", tvers=" + _targetVersion + "].");
return null; return null;
} }
@@ -543,21 +543,24 @@ public class Application
// start by assuming we are happy with our version // start by assuming we are happy with our version
_targetVersion = _version; _targetVersion = _version;
// now read in the contents of the version.txt file (if any) // if we are a versioned application, read in the contents of the
File vfile = getLocalPath(VERSION_FILE); // version.txt file
FileInputStream fin = null; if (_version != -1) {
try { File vfile = getLocalPath(VERSION_FILE);
fin = new FileInputStream(vfile); FileInputStream fin = null;
BufferedReader bin = new BufferedReader( try {
new InputStreamReader(fin)); fin = new FileInputStream(vfile);
String vstr = bin.readLine(); BufferedReader bin = new BufferedReader(
if (!StringUtil.blank(vstr)) { new InputStreamReader(fin));
_targetVersion = Integer.parseInt(vstr); String vstr = bin.readLine();
if (!StringUtil.blank(vstr)) {
_targetVersion = Integer.parseInt(vstr);
}
} catch (Exception e) {
Log.info("Unable to read version file: " + e.getMessage());
} finally {
StreamUtil.close(fin);
} }
} catch (Exception e) {
Log.info("Unable to read version file: " + e.getMessage());
} finally {
StreamUtil.close(fin);
} }
// finally let the caller know if we need an update // finally let the caller know if we need an update