Check for the proper version of the base package and exit gracefully if not
found.
This commit is contained in:
parent
ef5037fe42
commit
093960be31
3 changed files with 46 additions and 0 deletions
|
@ -181,6 +181,30 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
}
|
||||
|
||||
|
||||
// Return the current base package version
|
||||
string fgBasePackageVersion() {
|
||||
SGPath base_path( globals->get_fg_root() );
|
||||
base_path.append("version");
|
||||
|
||||
sg_gzifstream in( base_path.str() );
|
||||
if ( !in.is_open() ) {
|
||||
SGPath old_path( globals->get_fg_root() );
|
||||
old_path.append( "Thanks" );
|
||||
sg_gzifstream old( old_path.str() );
|
||||
if ( !old.is_open() ) {
|
||||
return "[none found]";
|
||||
} else {
|
||||
return "[old version, please upgrade]";
|
||||
}
|
||||
}
|
||||
|
||||
string version;
|
||||
in >> version;
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
// Read in configuration (file and command line)
|
||||
bool fgInitConfig ( int argc, char **argv ) {
|
||||
|
||||
|
|
|
@ -31,13 +31,27 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#include <Airports/simple.hxx>
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
||||
|
||||
// Read in configuration (file and command line) and just set fg_root
|
||||
bool fgInitFGRoot ( int argc, char **argv );
|
||||
|
||||
|
||||
// Return the current base package version
|
||||
string fgBasePackageVersion();
|
||||
|
||||
|
||||
// Read in configuration (file and command line)
|
||||
bool fgInitConfig ( int argc, char **argv );
|
||||
|
||||
|
|
|
@ -1481,6 +1481,14 @@ int main( int argc, char **argv ) {
|
|||
// fg_root was specified (ignore all other options for now)
|
||||
fgInitFGRoot(argc, argv);
|
||||
|
||||
// Check for the correct base package version
|
||||
string base_version = fgBasePackageVersion();
|
||||
if ( !(base_version == "0.7.9") ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Base package check failed ... "
|
||||
<< base_version);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Initialize the Aircraft directory to "" (UIUC)
|
||||
aircraft_dir = "";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue