本文整理汇总了C++中PackageInfoRef::FileName方法的典型用法代码示例。如果您正苦于以下问题:C++ PackageInfoRef::FileName方法的具体用法?C++ PackageInfoRef::FileName怎么用?C++ PackageInfoRef::FileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageInfoRef
的用法示例。
在下文中一共展示了PackageInfoRef::FileName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindAppToLaunch
static bool FindAppToLaunch(const PackageInfoRef& package,
DeskbarLinkList& foundLinks)
{
if (package.Get() == NULL)
return false;
int32 installLocation = InstallLocation(package);
BPath packagePath;
if (installLocation == B_PACKAGE_INSTALLATION_LOCATION_SYSTEM) {
if (find_directory(B_SYSTEM_PACKAGES_DIRECTORY, &packagePath)
!= B_OK) {
return false;
}
} else if (installLocation == B_PACKAGE_INSTALLATION_LOCATION_HOME) {
if (find_directory(B_USER_PACKAGES_DIRECTORY, &packagePath)
!= B_OK) {
return false;
}
} else {
printf("OpenPackageAction::FindAppToLaunch(): "
"unknown install location");
return false;
}
packagePath.Append(package->FileName());
BNoErrorOutput errorOutput;
BPackageReader reader(&errorOutput);
status_t status = reader.Init(packagePath.Path());
if (status != B_OK) {
printf("OpenPackageAction::FindAppToLaunch(): "
"failed to init BPackageReader(%s): %s\n",
packagePath.Path(), strerror(status));
return false;
}
// Scan package contents for Deskbar links
DeskbarLinkFinder contentHandler(foundLinks);
status = reader.ParseContent(&contentHandler);
if (status != B_OK) {
printf("OpenPackageAction::FindAppToLaunch(): "
"failed parse package contents (%s): %s\n",
packagePath.Path(), strerror(status));
return false;
}
return foundLinks.CountItems() > 0;
}