Fix #10100.
- If a package is already installed, look up its installed location and use that when initializing the package manager for uninstallation, otherwise we'd potentially fail to find the package, and consequently fail to remove it.
This commit is contained in:
@@ -22,9 +22,20 @@ PackageAction::PackageAction(int32 type, PackageInfoRef package, Model* model)
|
||||
fType(type),
|
||||
fModel(model)
|
||||
{
|
||||
const PackageInstallationLocationSet& locations
|
||||
= package->InstallationLocations();
|
||||
|
||||
int32 location = B_PACKAGE_INSTALLATION_LOCATION_HOME;
|
||||
// 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(
|
||||
B_PACKAGE_INSTALLATION_LOCATION_HOME);
|
||||
(BPackageInstallationLocation)location);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user