diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index 4d0c71df93..5079035ce7 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -766,13 +766,16 @@ void FileUtils::setSearchResolutionsOrder(const std::vector& search } } -void FileUtils::addSearchResolutionsOrder(const std::string &order) +void FileUtils::addSearchResolutionsOrder(const std::string &order,const bool front) { std::string resOrder = order; if (!resOrder.empty() && resOrder[resOrder.length()-1] != '/') resOrder.append("/"); - - _searchResolutionsOrderArray.push_back(resOrder); + if (front) { + _searchResolutionsOrderArray.insert(_searchResolutionsOrderArray.begin(), resOrder); + } else { + _searchResolutionsOrderArray.push_back(resOrder); + } } const std::vector& FileUtils::getSearchResolutionsOrder() @@ -819,7 +822,7 @@ void FileUtils::setSearchPaths(const std::vector& searchPaths) } } -void FileUtils::addSearchPath(const std::string &searchpath) +void FileUtils::addSearchPath(const std::string &searchpath,const bool front) { std::string prefix; if (!isAbsolutePath(searchpath)) @@ -830,7 +833,11 @@ void FileUtils::addSearchPath(const std::string &searchpath) { path += "/"; } - _searchPathArray.push_back(path); + if (front) { + _searchPathArray.insert(_searchPathArray.begin(), path); + } else { + _searchPathArray.push_back(path); + } } void FileUtils::setFilenameLookupDictionary(const ValueMap& filenameLookupDict) diff --git a/cocos/platform/CCFileUtils.h b/cocos/platform/CCFileUtils.h index 60e899ed35..570b02fc50 100644 --- a/cocos/platform/CCFileUtils.h +++ b/cocos/platform/CCFileUtils.h @@ -229,7 +229,7 @@ public: * @see setSearchResolutionsOrder(), fullPathForFilename(). * @since v2.1 */ - virtual void addSearchResolutionsOrder(const std::string &order); + virtual void addSearchResolutionsOrder(const std::string &order,const bool front=false); /** * Gets the array that contains the search order of the resources. @@ -266,7 +266,7 @@ public: * * @since v2.1 */ - void addSearchPath(const std::string & path); + void addSearchPath(const std::string & path, const bool front=false); /** * Gets the array of search paths.