IDE: When compressing a published package, give a valid name for the Zip file.

(cherry picked from commit 33e034b595)
This commit is contained in:
Juha 2025-07-19 23:19:54 +03:00
parent b51eb6f0e8
commit e98683ddc0

View File

@ -357,35 +357,33 @@ function TPublisher.Compress: TModalResult;
var
Zipper: TZipper;
ZipFileEntries: TZipFileEntries;
CurProject: TProject;
Drive, S: String;
I: Integer;
ZipDestDir: String;
RelPath, Drive: String;
begin
Result := mrNone;
CurProject := TProject(FOptions.Owner);
if CurProject = nil then
Exit;
ZipFileEntries := TZipFileEntries.Create(TZipFileEntry);
try
if DirPathExists(FDestDir) then
begin
for I := 0 to FCopiedFiles.Count - 1 do
begin
RelPath := ExtractRelativePath(FTopDir, FCopiedFiles[I]);
Drive := ExtractFileDrive(RelPath);
S := ExtractRelativePath(FTopDir, FCopiedFiles[I]);
Drive := ExtractFileDrive(S);
if Trim(Drive) <> '' then
RelPath := StringReplace(RelPath, AppendPathDelim(Drive), '', [rfIgnoreCase]);
ZipFileEntries.AddFileEntry(FDestDir + RelPath, RelPath);
S := StringReplace(S, AppendPathDelim(Drive), '', [rfIgnoreCase]);
ZipFileEntries.AddFileEntry(FDestDir + S, S);
end;
if (ZipFileEntries.Count > 0) then
begin
Zipper := TZipper.Create;
try
ZipDestDir := AppendPathDelim(LazarusIDE.GetPrimaryConfigPath);
Zipper.FileName := ChangeFileExt(ZipDestDir + ExtractFileName(CurProject.ProjectInfoFile), '.zip');
if FProjPack is TProject then
S := TProject(FProjPack).ProjectInfoFile
else
S := TLazPackage(FProjPack).Filename;
Zipper.FileName := AppendPathDelim(LazarusIDE.GetPrimaryConfigPath)
+ ExtractFileNameOnly(S)+'.zip';
try
Zipper.ZipFiles(ZipFileEntries);
if FileExists(Zipper.FileName) then