本文整理汇总了C++中BPackageRoster::GetUserRepositoryCachePath方法的典型用法代码示例。如果您正苦于以下问题:C++ BPackageRoster::GetUserRepositoryCachePath方法的具体用法?C++ BPackageRoster::GetUserRepositoryCachePath怎么用?C++ BPackageRoster::GetUserRepositoryCachePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPackageRoster
的用法示例。
在下文中一共展示了BPackageRoster::GetUserRepositoryCachePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: targetDirectory
status_t
BRefreshRepositoryRequest::_FetchRepositoryCache()
{
// download repository cache and put it in either the common/user cache
// path, depending on where the corresponding repo-config lives
// job fetching the cache
BEntry tempRepoCache;
status_t result = fContext.GetNewTempfile("repocache-", &tempRepoCache);
if (result != B_OK)
return result;
BString repoCacheURL = BString(fRepoConfig.BaseURL()) << "/" << "repo";
FetchFileJob* fetchCacheJob = new (std::nothrow) FetchFileJob(fContext,
BString("Fetching repository-cache from ") << fRepoConfig.BaseURL(),
repoCacheURL, tempRepoCache);
if (fetchCacheJob == NULL)
return B_NO_MEMORY;
if ((result = QueueJob(fetchCacheJob)) != B_OK) {
delete fetchCacheJob;
return result;
}
// job validating the cache's checksum
ValidateChecksumJob* validateChecksumJob
= new (std::nothrow) ValidateChecksumJob(fContext,
BString("Validating checksum for ") << fRepoConfig.Name(),
new (std::nothrow) ChecksumFileChecksumAccessor(
fFetchedChecksumFile),
new (std::nothrow) GeneralFileChecksumAccessor(tempRepoCache));
if (validateChecksumJob == NULL)
return B_NO_MEMORY;
validateChecksumJob->AddDependency(fetchCacheJob);
if ((result = QueueJob(validateChecksumJob)) != B_OK) {
delete validateChecksumJob;
return result;
}
// job activating the cache
BPath targetRepoCachePath;
BPackageRoster roster;
result = fRepoConfig.IsUserSpecific()
? roster.GetUserRepositoryCachePath(&targetRepoCachePath, true)
: roster.GetCommonRepositoryCachePath(&targetRepoCachePath, true);
if (result != B_OK)
return result;
BDirectory targetDirectory(targetRepoCachePath.Path());
ActivateRepositoryCacheJob* activateJob
= new (std::nothrow) ActivateRepositoryCacheJob(fContext,
BString("Activating repository cache for ") << fRepoConfig.Name(),
tempRepoCache, fRepoConfig.Name(), targetDirectory);
if (activateJob == NULL)
return B_NO_MEMORY;
activateJob->AddDependency(validateChecksumJob);
if ((result = QueueJob(activateJob)) != B_OK) {
delete activateJob;
return result;
}
return B_OK;
}