1 package org.gffs.version;
4 import java.io.IOException;
6 import org.gffs.application.ProgramTools;
8 public class VersionManager
10 static private final String VERSION_FILENAME = "current.version";
12 private Version _currentVersion;
13 private File _versionFile;
15 public VersionManager()
17 _versionFile = new File(ProgramTools.getInstallationDirectory(), VERSION_FILENAME);
18 _currentVersion = null;
21 public Version getCurrentVersion() throws IOException
23 if (_currentVersion == null) {
24 // we go with the installer scheme to start with, where there's a current.version in the
26 if (!_versionFile.exists()) {
27 // try failing over to the source code's version of the file inside the installer
29 _versionFile = new File(ProgramTools.getInstallationDirectory(), "installer/" + VERSION_FILENAME);
30 if (!_versionFile.exists()) {
31 _currentVersion = Version.EMPTY_VERSION;
34 if (_versionFile.exists()) {
35 _currentVersion = new Version(_versionFile);
39 return _currentVersion;