Hi,

currently, when OSG searches for files (relative paths to images/textures/models/...), it tries to resolve against the current working directory first. So the CWD has precedence over any path configured in the "database path list" (osgDB::Options). And since that's hard-coded, I can't opt out, though I do not want my application to ever load anything from the CWD.

If that was unintentional, you could consider the patch attached to stop resolving relative paths against the CWD. Otherwise, if that's a feature, I'd really like to have an option to disable this - i.e. another flag in osgDB::Options or alike. Remember, any application relying on the CWD being considered, could still add that path (or even an empty path) to the "DatabasePathList" to get the original behaviour - and this would also allow the application to control the CWD's precedence.

cheers,
Thorsten

diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp
index e3fd206..00704df 100644
--- a/src/osgDB/Registry.cpp
+++ b/src/osgDB/Registry.cpp
@@ -973,7 +973,7 @@ std::string Registry::findDataFileImplementation(const std::string& filename, co
     // if data file contains a server address then we can't find it in local directories so return empty string.
     if (containsServerAddress(filename)) return std::string();
 
-    if(fileExists(filename))
+    if (osgDB::isAbsolutePath(filename) && fileExists(filename))
     {
         OSG_DEBUG << "FindFileInPath(" << filename << "): returning " << filename << std::endl;
         return filename;



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to