1
0
Fork 0

Call fgInitAllowedPaths() earlier: after Options::processOptions()

Call fgInitAllowedPaths() right after Options::processOptions() (which,
among other things, determines $FG_ROOT and processes
--allow-nasal-read). This way, fgInitAllowedPaths() can be used in much
more code, such as when initializing subsystems.
This commit is contained in:
Florent Rougon 2017-08-26 17:49:30 +02:00
parent 41045f3bf3
commit c7a2aef599
3 changed files with 10 additions and 4 deletions

View file

@ -1145,6 +1145,11 @@ void fgStartNewReset()
flightgear::Options::sharedInstance()->processOptions();
// Rebuild the lists of allowed paths for cases where a path comes from an
// untrusted source, such as the global property tree (this uses $FG_HOME
// and other paths set by Options::processOptions()).
fgInitAllowedPaths();
const auto& resMgr = simgear::EmbeddedResourceManager::instance();
// The language was (re)set in processOptions()
const string locale = globals->get_locale()->getPreferredLanguage();

View file

@ -541,6 +541,11 @@ int fgMainInit( int argc, char **argv )
return EXIT_SUCCESS;
}
// Set the lists of allowed paths for cases where a path comes from an
// untrusted source, such as the global property tree (this uses $FG_HOME
// and other paths set by Options::processOptions()).
fgInitAllowedPaths();
const auto& resMgr = simgear::EmbeddedResourceManager::createInstance();
initFlightGearEmbeddedResources();
// The language was set in processOptions()

View file

@ -911,10 +911,6 @@ void FGNasalSys::init()
.member("simulatedTime", &TimerObj::isSimTime, &f_timerObj_setSimTime)
.member("isRunning", &TimerObj::isRunning);
// Set allowed paths for Nasal I/O
fgInitAllowedPaths();
// Now load the various source files in the Nasal directory
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
loadScriptDirectory(nasalDir);