Opkman: After a package is opened with "Open package file(.lpk)...", OPM wrongly reports the package as installed when in fact is not.

git-svn-id: trunk@59717 -
This commit is contained in:
balazs 2018-12-03 07:32:02 +00:00
parent 01d74c39d2
commit 7a770dfa0c
2 changed files with 23 additions and 24 deletions

View File

@ -807,13 +807,15 @@ procedure TMainFrm.tbUninstallClick(Sender: TObject);
function GetIDEPackage(const AFileName: String): TIDEPackage;
var
I: Integer;
IDEPackge: TIDEPackage;
begin
Result := nil;
for I := 0 to PackageEditingInterface.GetPackageCount - 1 do
begin
if UpperCase(PackageEditingInterface.GetPackages(I).Filename) = UpperCase(AFileName) then
IDEPackge := PackageEditingInterface.GetPackages(I);
if UpperCase(IDEPackge.Filename) = UpperCase(AFileName) then
begin
Result := PackageEditingInterface.GetPackages(I);
Result := IDEPackge;
Break;
end;
end;
@ -858,7 +860,7 @@ begin
end;
lptDesignTime, lptRunAndDesignTime:
begin
IDEPackage := GetIDEPackage(LazarusPackage.PackageAbsolutePath);
IDEPackage := GetIDEPackage(LazarusPackage.InstalledFileName);
if IDEPackage <> nil then
begin
if PackageEditingInterface.UninstallPackage(IDEPackage, False) <> mrOk then

View File

@ -1121,30 +1121,27 @@ function TSerializablePackages.IsPackageInstalled(const ALazarusPkg: TLazarusPac
function CheckIDEPackages: Boolean;
var
PackageCnt: Integer;
I: Integer;
Package: TIDEPackage;
IDEPkg: TIDEPackage;
PkgExt: String;
PkgName: String;
begin
Result := False;
PackageCnt := PackageEditingInterface.GetPackageCount;
for I := 0 to PackageCnt - 1 do
PkgExt := ExtractFileExt(ALazarusPkg.Name);
PkgName := StringReplace(ALazarusPkg.Name, PkgExt, '', [rfIgnoreCase]);
IDEPkg := PackageEditingInterface.IsPackageInstalled(PkgName);
if IDEPkg <> nil then
begin
Package := PackageEditingInterface.GetPackages(I);
if ExtractFileName(Package.FileName) = ALazarusPkg.Name then
begin
ALazarusPkg.InstalledFileName := Package.Filename;
ALazarusPkg.InstalledFileVersion := IntToStr(Package.Version.Major) + '.' +
IntToStr(Package.Version.Minor) + '.' +
IntToStr(Package.Version.Release) + '.' +
IntToStr(Package.Version.Build);
if FileExists(ALazarusPkg.InstalledFileName) then
begin
ALazarusPkg.InstalledFileDescription := GetPackageDescription(Package.Filename);
ALazarusPkg.InstalledFileLincese := GetPackageLicense(Package.Filename);
end;
Result := True;
Break;
end;
ALazarusPkg.InstalledFileName := IDEPkg.Filename;
ALazarusPkg.InstalledFileVersion := IntToStr(IDEPkg.Version.Major) + '.' +
IntToStr(IDEPkg.Version.Minor) + '.' +
IntToStr(IDEPkg.Version.Release) + '.' +
IntToStr(IDEPkg.Version.Build);
if FileExists(ALazarusPkg.InstalledFileName) then
begin
ALazarusPkg.InstalledFileDescription := GetPackageDescription(IDEPkg.Filename);
ALazarusPkg.InstalledFileLincese := GetPackageLicense(IDEPkg.Filename);
end;
Result := True;
end;
end;