diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index 155817e247..6495b2d0d5 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -109,17 +109,22 @@ void Bundle3D::purgeBundle3D() bool Bundle3D::load(const std::string& path) { std::string strFileString = FileUtils::getInstance()->getStringFromFile(path); - ssize_t size = strFileString.length(); - - CC_SAFE_DELETE_ARRAY(_documentBuffer); - _documentBuffer = new char[size + 1]; - memcpy(_documentBuffer, strFileString.c_str(), size); - _documentBuffer[size] = '\0'; - if (document.ParseInsitu<0>(_documentBuffer).HasParseError()) + if (strFileString != _fullPath) { - assert(0); - return false; + ssize_t size = strFileString.length(); + + CC_SAFE_DELETE_ARRAY(_documentBuffer); + _documentBuffer = new char[size + 1]; + memcpy(_documentBuffer, strFileString.c_str(), size); + _documentBuffer[size] = '\0'; + if (document.ParseInsitu<0>(_documentBuffer).HasParseError()) + { + assert(0); + return false; + } + _fullPath = strFileString; } + return true; } diff --git a/cocos/3d/CCBundle3D.h b/cocos/3d/CCBundle3D.h index ba124da7dd..5188873c4b 100644 --- a/cocos/3d/CCBundle3D.h +++ b/cocos/3d/CCBundle3D.h @@ -94,6 +94,7 @@ protected: char* _documentBuffer; rapidjson::Document document; + std::string _fullPath; bool _isBinary; };