diff --git a/src/gltf/TextureBuilder.cpp b/src/gltf/TextureBuilder.cpp index 752136f..b2325e5 100644 --- a/src/gltf/TextureBuilder.cpp +++ b/src/gltf/TextureBuilder.cpp @@ -201,6 +201,9 @@ std::shared_ptr TextureBuilder::simple(int rawTexIndex, const std:: } else if (!relativeFilename.empty()) { image = new ImageData(relativeFilename, relativeFilename); std::string outputPath = outputFolder + "/" + relativeFilename; + auto srcAbs = FileUtils::GetAbsolutePath(rawTexture.fileLocation); + auto dstAbs = FileUtils::GetAbsolutePath(outputPath); + if (srcAbs != dstAbs) if (FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) { if (verboseOutput) { fmt::printf("Copied texture '%s' to output folder: %s\n", textureName, outputPath); diff --git a/src/utils/File_Utils.hpp b/src/utils/File_Utils.hpp index 8a2aa12..10f31ca 100644 --- a/src/utils/File_Utils.hpp +++ b/src/utils/File_Utils.hpp @@ -34,7 +34,7 @@ bool CopyFile( bool createPath = false); inline std::string GetAbsolutePath(const std::string& filePath) { - return boost::filesystem::absolute(filePath).string(); + return boost::filesystem::canonical(boost::filesystem::absolute(filePath)).string(); } inline std::string GetCurrentFolder() {