From 0a256038d38e09fdb6a8f0b831f4b550e0ecce2e Mon Sep 17 00:00:00 2001 From: "Rebecca N. Palmer" Date: Tue, 18 Oct 2016 22:29:44 +0100 Subject: [PATCH] Remove set-scenery-paths, make all scenery paths Nasal-readable (It was probably broken anyway, due to path caching in tilemgr.cxx) --- src/Main/fg_commands.cxx | 33 --------------------------------- src/Main/globals.cxx | 8 +++----- src/Main/globals.hxx | 11 +++++------ src/Main/options.cxx | 4 ++-- 4 files changed, 10 insertions(+), 46 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 2259e4c9f..93c5d0686 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1342,38 +1342,6 @@ do_profiler_stop(const SGPropertyNode *arg) } -static bool -do_set_scenery_paths(const SGPropertyNode* arg) -{ - globals->clear_fg_scenery(); - - std::string terrasyncPath(globals->get_terrasync_dir().local8BitStr()); - bool seenTerrasyncPath = false; - - simgear::PropertyList paths = arg->getChildren("path"); - for (size_t i = 0; i < paths.size(); ++i) { - std::string s = paths[i]->getStringValue(); - if (s == terrasyncPath) { - seenTerrasyncPath = true; - } - - globals->append_fg_scenery(s); - } - - if (fgGetBool("/sim/terrasync/enabled") && !seenTerrasyncPath) { - globals->append_fg_scenery(terrasyncPath); - } - - if (paths.empty()) { - // no scenery paths set *at all*, use the data in FG_ROOT - SGPath root(globals->get_fg_root()); - root.append("Scenery"); - globals->append_fg_scenery(root); - } - - return true; -} - //////////////////////////////////////////////////////////////////////// // Command setup. //////////////////////////////////////////////////////////////////////// @@ -1449,7 +1417,6 @@ static struct { { "print-visible-scene", do_print_visible_scene_info }, { "reload-shaders", do_reload_shaders }, { "reload-materials", do_materials_reload }, - { "set-scenery-paths", do_set_scenery_paths }, { "profiler-start", do_profiler_start }, { "profiler-stop", do_profiler_stop }, diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 6659abe50..8446a4573 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -329,14 +329,14 @@ SGPath FGGlobals::find_data_dir(const std::string& pathSuffix) const return SGPath(); } -void FGGlobals::append_fg_scenery (const PathList &paths, bool secure) +void FGGlobals::append_fg_scenery (const PathList &paths) { BOOST_FOREACH(const SGPath& path, paths) { append_fg_scenery(path); } } -void FGGlobals::append_fg_scenery (const SGPath &path, bool secure) +void FGGlobals::append_fg_scenery (const SGPath &path) { SGPropertyNode* sim = fgGetNode("/sim", true); @@ -374,9 +374,7 @@ void FGGlobals::append_fg_scenery (const SGPath &path, bool secure) // no information as to why the change was made. fg_scenery.push_back(abspath); unmangled_fg_scenery.push_back(abspath); - if (secure) { - extra_read_allowed_paths.push_back(abspath); - } + extra_read_allowed_paths.push_back(abspath); if (terrainDir.exists()) { fg_scenery.push_back(terrainDir); diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 82eb34103..eec8128ae 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -230,14 +230,13 @@ public: /** * Add a scenery directory * - * secure = allow Nasal to read this directory; to avoid - * can-read-any-file security holes, do NOT set this on directories - * obtained from the property tree (e.g. /sim/terrasync/scenery-dir) - * or other Nasal-writable places + * This also makes the path Nasal-readable: + * to avoid can-read-any-file security holes, do NOT call this on paths + * obtained from the property tree or other Nasal-writable places */ - void append_fg_scenery (const SGPath &scenery, bool secure = false); + void append_fg_scenery (const SGPath &scenery); - void append_fg_scenery (const PathList &scenery, bool secure = false); + void append_fg_scenery (const PathList &scenery); void clear_fg_scenery(); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 5321266ae..894e6aade 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -852,7 +852,7 @@ fgOptRoc( const char *arg ) static int fgOptFgScenery( const char *arg ) { - globals->append_fg_scenery(SGPath::pathsFromLocal8Bit(arg), true); + globals->append_fg_scenery(SGPath::pathsFromLocal8Bit(arg)); return FG_OPTIONS_OK; } @@ -2372,7 +2372,7 @@ OptionResult Options::processOptions() // now options are process, do supplemental fixup const char *envp = ::getenv( "FG_SCENERY" ); if (envp) { - globals->append_fg_scenery(SGPath::pathsFromEnv("FG_SCENERY"), true); + globals->append_fg_scenery(SGPath::pathsFromEnv("FG_SCENERY")); } // download dir fix-up