Merge pull request #7283 from taug/v3

could add seach path and resolution order path in front.
This commit is contained in:
minggo 2014-07-17 10:34:45 +08:00
commit 43fe305cc9
2 changed files with 14 additions and 7 deletions

View File

@ -766,13 +766,16 @@ void FileUtils::setSearchResolutionsOrder(const std::vector<std::string>& 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<std::string>& FileUtils::getSearchResolutionsOrder()
@ -819,7 +822,7 @@ void FileUtils::setSearchPaths(const std::vector<std::string>& 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)

View File

@ -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.