#658: better bugfix for findDataFile issue
Fixes the more basic probelm of "SGModelLib::findDataFile" resolving an empty file name to the fgdata (directory) path. findData_File_ should never return a _directory_ path, only valid _file_ names.
This commit is contained in:
@@ -216,14 +216,11 @@ TexTuple makeTexTuple(Effect* effect, const SGPropertyNode* props,
|
||||
if (pImage)
|
||||
{
|
||||
imageName = pImage->getStringValue();
|
||||
if (!imageName.empty())
|
||||
absFileName = SGModelLib::findDataFile(imageName, options);
|
||||
if (absFileName.empty())
|
||||
{
|
||||
absFileName = SGModelLib::findDataFile(imageName, options);
|
||||
if (absFileName.empty())
|
||||
{
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '"
|
||||
<< imageName << "'");
|
||||
}
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '"
|
||||
<< imageName << "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,13 @@ std::string SGModelLib::findDataFile(const std::string& file,
|
||||
const osgDB::ReaderWriter::Options* opts,
|
||||
SGPath currentPath)
|
||||
{
|
||||
if (file.empty())
|
||||
return file;
|
||||
SGPath p = ResourceManager::instance()->findPath(file, currentPath);
|
||||
if (p.exists()) {
|
||||
if (p.exists()&&p.isFile()) {
|
||||
return p.str();
|
||||
}
|
||||
|
||||
|
||||
// finally hand on to standard OSG behaviour
|
||||
return osgDB::findDataFile(file, opts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user