From: Thomas Geymayer Date: Mon, 29 Apr 2013 20:16:29 +0000 (+0200) Subject: Allow Canvas to also read images with absolute paths (if allowed by IOrules) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=952a61424ade8df31aa2a76e3d5e1eccaa4223a2;p=flightgear.git Allow Canvas to also read images with absolute paths (if allowed by IOrules) --- diff --git a/src/Canvas/FGCanvasSystemAdapter.cxx b/src/Canvas/FGCanvasSystemAdapter.cxx index c91c5d17c..576e859b1 100644 --- a/src/Canvas/FGCanvasSystemAdapter.cxx +++ b/src/Canvas/FGCanvasSystemAdapter.cxx @@ -19,6 +19,7 @@ #include "FGCanvasSystemAdapter.hxx" #include
+#include
#include #include @@ -77,14 +78,24 @@ namespace canvas //---------------------------------------------------------------------------- osg::Image* FGCanvasSystemAdapter::getImage(const std::string& path) const { - SGPath tpath = globals->resolve_resource_path(path); - if( tpath.isNull() || !tpath.exists() ) + if( SGPath(path).isAbsolute() ) { - SG_LOG(SG_GL, SG_ALERT, "canvas::Image: No such image: " << path); - return 0; + const char* valid_path = fgValidatePath(path.c_str(), false); + if( valid_path ) + return osgDB::readImageFile(valid_path); + + SG_LOG(SG_IO, SG_ALERT, "canvas::Image: reading '" << path << "' denied"); + } + else + { + SGPath tpath = globals->resolve_resource_path(path); + if( !tpath.isNull() ) + return osgDB::readImageFile(tpath.c_str()); + + SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'"); } - return osgDB::readImageFile(tpath.c_str()); + return 0; } /**