1
0
Fork 0

Remove set-scenery-paths, make all scenery paths Nasal-readable

(It was probably broken anyway, due to path caching in tilemgr.cxx)
This commit is contained in:
Rebecca N. Palmer 2016-10-18 22:29:44 +01:00
parent 9f6ce5625c
commit 0a256038d3
4 changed files with 10 additions and 46 deletions

View file

@ -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 },

View file

@ -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);
}
if (terrainDir.exists()) {
fg_scenery.push_back(terrainDir);

View file

@ -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();

View file

@ -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