diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 5f2d78d2ed..72349dadb1 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -1,6 +1,7 @@ #include "scenemanager.hpp" #include +#include #include #include @@ -10,6 +11,7 @@ #include +#include #include #include @@ -472,9 +474,14 @@ namespace Resource osgDB::ReaderWriter::ReadResult readImage(const std::string& filename, const osgDB::Options* options) override { + std::filesystem::path filePath(filename); + if (filePath.is_absolute()) + // It is a hack. Needed because either OSG or libcollada-dom tries to make an absolute path from + // our relative VFS path by adding current working directory. + filePath = std::filesystem::relative(filename, osgDB::getCurrentWorkingDirectory()); try { - return osgDB::ReaderWriter::ReadResult(mImageManager->getImage(filename), osgDB::ReaderWriter::ReadResult::FILE_LOADED); + return osgDB::ReaderWriter::ReadResult(mImageManager->getImage(filePath), osgDB::ReaderWriter::ReadResult::FILE_LOADED); } catch (std::exception& e) {