]> git.mxchange.org Git - flightgear.git/commitdiff
Allow FG data to be in $FG_ROOT/data or $FG_ROOT (looks in both places.)
authorcurt <curt>
Thu, 24 Apr 2003 02:18:12 +0000 (02:18 +0000)
committercurt <curt>
Thu, 24 Apr 2003 02:18:12 +0000 (02:18 +0000)
src/Main/globals.cxx
src/Main/globals.hxx

index 34432d99b64c31489015d38e72d766e5c7bc979f..032781539b6beae3f007c3bc072bd92268e03eab 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include <simgear/misc/commands.hxx>
+#include <simgear/misc/sg_path.hxx>
 
 #include <Environment/environment_mgr.hxx>
 
@@ -91,6 +92,20 @@ FGGlobals::~FGGlobals()
 }
 
 
+// set the fg_root path
+void FGGlobals::set_fg_root (const string &root) {
+    fg_root = root;
+    
+    // append /data to root if it exists
+    SGPath tmp( fg_root );
+    tmp.append( "data" );
+    tmp.append( "version" );
+    if ( ulFileExists( tmp.c_str() ) ) {
+        fg_root += "/data";
+        }
+}
+
+
 FGSubsystemMgr *
 FGGlobals::get_subsystem_mgr () const
 {
index 2b64fcdb8286740266ae34c7f13b242d4448796c..52821b7f41ad102ee7216556c449ed5d79406ad3 100644 (file)
@@ -206,7 +206,7 @@ public:
     inline void set_sim_time_sec (double t) { sim_time_sec = t; }
 
     inline const string &get_fg_root () const { return fg_root; }
-    inline void set_fg_root (const string &root) { fg_root = root; }
+    void set_fg_root (const string &root);
 
     inline const string &get_fg_scenery () const { return fg_scenery; }
     inline void set_fg_scenery (const string &scenery) {