diff --git a/src/osgPlugins/ac/ac3d.cpp b/src/osgPlugins/ac/ac3d.cpp index 79bebba90..b4a1ea3b7 100644 --- a/src/osgPlugins/ac/ac3d.cpp +++ b/src/osgPlugins/ac/ac3d.cpp @@ -1120,14 +1120,16 @@ readObject(std::istream& stream, FileData& fileData, const osg::Matrix& parentTr else if (token == "texture") { // read the texture name std::string texname = readString(stream); - - // strip the path to the texture, just look in the directory we read the ac file - std::string::size_type p = texname.rfind('\\'); - if (p != std::string::npos) - texname = texname.substr(p+1, std::string::npos); - p = texname.rfind('/'); - if (p != std::string::npos) - texname = texname.substr(p+1, std::string::npos); + + // strip absolute paths + if (texname[0] == '/' || isalpha(texname[0]) && texname[1] == ':') { + std::string::size_type p = texname.rfind('\\'); + if (p != std::string::npos) + texname = texname.substr(p+1, std::string::npos); + p = texname.rfind('/'); + if (p != std::string::npos) + texname = texname.substr(p+1, std::string::npos); + } textureData = fileData.toTextureData(texname); }