From a16d03a6cda7a23424fdf8d3944a12d67520c11e Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 24 Apr 2003 02:18:12 +0000 Subject: [PATCH] Allow FG data to be in $FG_ROOT/data or $FG_ROOT (looks in both places.) --- src/Main/globals.cxx | 15 +++++++++++++++ src/Main/globals.hxx | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 34432d99b..032781539 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -22,6 +22,7 @@ #include +#include #include @@ -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 { diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 2b64fcdb8..52821b7f4 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -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) { -- 2.39.5