Call fgInitAllowedPaths() between updates of aircraft paths and -set.xml parsing
fgInitAircraft() loads the aircraft -set.xml file, which calls ResourceManager::findPath() for each 'include=...' directive. In order to prevent such includes from triggering the new warning printed by ResourceManager::findPath(), call fgInitAllowedPaths() after the aircraft paths have been updated and before the -set.xml file is loaded. Thanks to Alan Teeder for reporting the problem. We can now probably remove the call to fgInitAllowedPaths() after processOptions() in fgStartNewReset() (I believe the newly-added call comes “soon enough”). Not doing so in this commit, though: let's fix problems before optimizing.
This commit is contained in:
parent
563bc4775f
commit
9fc5f30a93
3 changed files with 8 additions and 1 deletions
|
@ -1394,7 +1394,7 @@ void fgStartNewReset()
|
|||
// 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();
|
||||
fgInitAllowedPaths(); // FIXME: this call is probably not necessary anymore
|
||||
|
||||
const auto& resMgr = simgear::EmbeddedResourceManager::instance();
|
||||
// The language was (re)set in processOptions()
|
||||
|
@ -1413,6 +1413,7 @@ void fgStartNewReset()
|
|||
|
||||
fgGetNode("/sim")->removeChild("aircraft-dir");
|
||||
fgInitAircraftPaths(true);
|
||||
fgInitAllowedPaths(); // take the new aircraft paths into account
|
||||
fgInitAircraft(true, false /* not from launcher */);
|
||||
|
||||
render = new FGRenderer(composite_viewer);
|
||||
|
|
|
@ -703,6 +703,7 @@ int fgMainInit( int argc, char **argv )
|
|||
|
||||
fgInitSecureMode();
|
||||
fgInitAircraftPaths(false);
|
||||
fgInitAllowedPaths(); // take the new aircraft paths into account
|
||||
|
||||
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
|
||||
errorManager->preinit();
|
||||
|
|
|
@ -78,6 +78,11 @@ fgGetLowPass (double current, double target, double timeratio)
|
|||
*/
|
||||
void fgInitAllowedPaths()
|
||||
{
|
||||
static unsigned int fgInitAllowedPaths_nbCalls = 0;
|
||||
fgInitAllowedPaths_nbCalls++;
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "fgInitAllowedPaths() started (call " <<
|
||||
fgInitAllowedPaths_nbCalls << ")");
|
||||
|
||||
if(SGPath("ygjmyfvhhnvdoesnotexist").realpath().utf8Str() == "ygjmyfvhhnvdoesnotexist"){
|
||||
// Abort in case this is used with older versions of realpath()
|
||||
// that don't normalize non-existent files, as that would be a security
|
||||
|
|
Loading…
Reference in a new issue