本文整理汇总了C++中Manifest::getSearchPaths方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::getSearchPaths方法的具体用法?C++ Manifest::getSearchPaths怎么用?C++ Manifest::getSearchPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest::getSearchPaths方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadLocalManifest
void AssetsManagerEx::loadLocalManifest(const std::string& /*manifestUrl*/)
{
Manifest *cachedManifest = nullptr;
// Find the cached manifest file
if (_fileUtils->isFileExist(_cacheManifestPath))
{
cachedManifest = new (std::nothrow) Manifest();
if (cachedManifest) {
cachedManifest->parse(_cacheManifestPath);
if (!cachedManifest->isLoaded())
{
_fileUtils->removeFile(_cacheManifestPath);
CC_SAFE_RELEASE(cachedManifest);
cachedManifest = nullptr;
}
}
}
// Ensure no search path of cached manifest is used to load this manifest
std::vector<std::string> searchPaths = _fileUtils->getSearchPaths();
if (cachedManifest)
{
std::vector<std::string> cacheSearchPaths = cachedManifest->getSearchPaths();
std::vector<std::string> trimmedPaths = searchPaths;
for (auto path : cacheSearchPaths)
{
const auto pos = std::find(trimmedPaths.begin(), trimmedPaths.end(), path);
if (pos != trimmedPaths.end())
{
trimmedPaths.erase(pos);
}
}
_fileUtils->setSearchPaths(trimmedPaths);
}
// Load local manifest in app package
_localManifest->parse(_manifestUrl);
if (cachedManifest) {
// Restore search paths
_fileUtils->setSearchPaths(searchPaths);
}
if (_localManifest->isLoaded())
{
// Compare with cached manifest to determine which one to use
if (cachedManifest) {
bool localNewer = _localManifest->versionGreater(cachedManifest, _versionCompareHandle);
if (localNewer)
{
// Recreate storage, to empty the content
_fileUtils->removeDirectory(_storagePath);
_fileUtils->createDirectory(_storagePath);
CC_SAFE_RELEASE(cachedManifest);
}
else
{
CC_SAFE_RELEASE(_localManifest);
_localManifest = cachedManifest;
}
}
prepareLocalManifest();
}
// Fail to load local manifest
if (!_localManifest->isLoaded())
{
CCLOG("AssetsManagerEx : No local manifest file found error.\n");
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST);
}
}