#1 2023-09-07 23:43:07

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Suggestion for TZipWrite.AddFolder

Hi AB,
I have been using TZipWrite to add multiple folders to a ZIP but their contents all get merged into the root of the ZIP file.
My solution was to add a 'ZipFolder' parameter to the procedure so you can specify a Foldername to use inside the ZIP file....

procedure TZipWrite.AddFolder(const FolderName: TFileName; const Mask: TFileName;
  Recursive: boolean; CompressLevel: integer;
  ZipFolder: TFileName = '');
..
..
begin
  if ZipFolder <> '' then
    ZipFolder:= IncludeTrailingPathDelimiter(ZipFolder);
  result := RecursiveAdd(IncludeTrailingPathDelimiter(FolderName), ZipFolder);
end;

Tested with mORMot1. I see mORMot2 is a little different but functionally the same smile

Offline

#2 2023-09-08 06:01:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: Suggestion for TZipWrite.AddFolder

Good idea.

Please try https://synopse.info/fossil/info/82039c7872 for mORMot 1
and https://github.com/synopse/mORMot2/commit/fd4afbcf for mORMot 2.

Thanks for the suggestion!

Offline

Board footer

Powered by FluxBB