From 64c5ed2be1da8eed6a75f6cdd7e7590b0c9d2d69 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Wed, 24 Aug 2022 15:03:44 +0200 Subject: [PATCH] ResourceManager::findPath(): adjust a comment Based on a discussion on flightgear-devel (see in particular James Turner's message at [1]). [1] https://sourceforge.net/p/flightgear/mailman/message/37697739/ --- simgear/misc/ResourceManager.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/simgear/misc/ResourceManager.cxx b/simgear/misc/ResourceManager.cxx index dec847f5..fe00b2e8 100644 --- a/simgear/misc/ResourceManager.cxx +++ b/simgear/misc/ResourceManager.cxx @@ -150,12 +150,11 @@ SGPath ResourceManager::findPath(const std::string& aResource, SGPath aContext) } } - // Normally, we could skip this loop when completePath.isAbsolute() is - // true. However, we currently need it because a bunch of PropertyList - // files in $FG_ROOT/Materials, such as - // $FG_ROOT/Materials/regions/materials.xml, rely on a BasePathProvider to - // open included files with a path given relatively to $FG_ROOT - // (readProperties() uses this function to locate included files). + // Loop over the resource providers even if 'completePath' is absolute. + // For instance, when readProperties() processes 'include' attributes, it + // is expected that 'aResource' be interpreted relatively to 'aContext' + // or, if this doesn't lead to an existing file, a data path like + // $FG_ROOT. In the latter case, BasePathProvider will do the job. for (const auto& provider : _providers) { const SGPath path = provider->resolve(aResource, aContext); if (!path.isNull()) {