コード例 #1
0
int32
PackageAction::InstallLocation(const PackageInfoRef& package)
{
    const PackageInstallationLocationSet& locations
        = package->InstallationLocations();

    // If the package is already installed, return its first installed location
    if (locations.size() != 0)
        return *locations.begin();

    return B_PACKAGE_INSTALLATION_LOCATION_SYSTEM;
}
コード例 #2
0
ファイル: PackageAction.cpp プロジェクト: DonCN/haiku
PackageAction::PackageAction(int32 type, PackageInfoRef package, Model* model)
	:
	fPackage(package),
	fType(type),
	fModel(model)
{
	const PackageInstallationLocationSet& locations
		= package->InstallationLocations();

	int32 location = B_PACKAGE_INSTALLATION_LOCATION_SYSTEM;
	// if the package is already installed, use its first installed location
	// to initialize the manager.
	// TODO: ideally if the package is installed at multiple locations,
	// the user should be able to pick which one to remove.
	if (locations.size() != 0)
		location = *locations.begin();

	// TODO: allow configuring the installation location
	fPackageManager = new(std::nothrow) PackageManager(
		(BPackageInstallationLocation)location);
}