]> git.mxchange.org Git - flightgear.git/commitdiff
Check for the proper version of the base package and exit gracefully if not
authorcurt <curt>
Mon, 16 Jul 2001 19:17:58 +0000 (19:17 +0000)
committercurt <curt>
Mon, 16 Jul 2001 19:17:58 +0000 (19:17 +0000)
found.

src/Main/fg_init.cxx
src/Main/fg_init.hxx
src/Main/main.cxx

index 5f72d1930511779760a30b3af547d7dae8af3516..58fa1f1b541e2962c1b628e6043841c9618394c2 100644 (file)
@@ -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 ) {
 
index a0ef346af5fd58afa6508fa8f7db0103d1fbe6bc..ea53fdb8b316cb44a35c709c7154001ab0241cd0 100644 (file)
 #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 );
 
index 0ef9568f1c4bfae733583347cb58e317ec85c83d..1122fb2e153026e38b28885ddd4556aa1bd4bc2a 100644 (file)
@@ -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 = "";