mORMot and Open Source friends
Check-in [82039c7872]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{6444} include optional ZipFolder to TZipWrite.AddFolder - as suggested by https://synopse.info/forum/viewtopic.php?id=6696
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 82039c7872a6bdc34a5a12242e5b882f2948e7ac
User & Date: ab 2023-09-08 05:59:55
Context
2023-09-16
12:51
{6445} fixed TPdfEnum.TextOut clipping - as reported by https://github.com/synopse/SynPDF/pull/71 check-in: ca515773ad user: ab tags: trunk
2023-09-08
05:59
{6444} include optional ZipFolder to TZipWrite.AddFolder - as suggested by https://synopse.info/forum/viewtopic.php?id=6696 check-in: 82039c7872 user: ab tags: trunk
2023-08-24
08:18
{6443} enhanced Sqlite3 compilation documentation check-in: 645e5286a2 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynZip.pas.

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
....
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
....
1051
1052
1053
1054
1055
1056
1057


1058
1059
1060
1061
1062
1063
1064
1065
    /// compress (using the deflate method) a file, and add it to the zip file
    procedure AddDeflated(const aFileName: TFileName; RemovePath: boolean=true;
      CompressLevel: integer=6; ZipName: TFileName=''); overload;
    /// compress (using the deflate method) all files within a folder, and
    // add it to the zip file
    // - if Recursive is TRUE, would include files from nested sub-folders
    procedure AddFolder(const FolderName: TFileName; const Mask: TFileName=ZIP_FILES_ALL;
      Recursive: boolean=true; CompressLevel: integer=6);
    /// release associated memory, and close destination file
    destructor Destroy; override;
  end;

  /// write-only access for creating a .zip archive into a stream
  TZipWriteToStream = class(TZipWriteAbstract)
  protected
................................................................................

procedure TZipWrite.InternalWrite(const buf; len: cardinal);
begin
  FileWrite(Handle,buf,len);
end;

procedure TZipWrite.AddFolder(const FolderName: TFileName; const Mask: TFileName;
  Recursive: boolean; CompressLevel: integer);
procedure RecursiveAdd(const fileDir,zipDir: TFileName);
var f: TSearchRec;
begin
  if Recursive then
    if FindFirst(fileDir+ZIP_FILES_ALL,faDirectory,f)=0 then begin
      repeat
        if f.Name[1]<>'.' then
................................................................................
        {$WARN SYMBOL_DEPRECATED ON}
        {$endif}
    until FindNext(f)<>0;
    FindClose(f);
  end;
end;
begin


  RecursiveAdd(IncludeTrailingPathDelimiter(FolderName),'');
end;

procedure TZipWrite.AddDeflated(const aFileName: TFileName; RemovePath: boolean;
  CompressLevel: integer; ZipName: TFileName);
var {$ifdef MSWINDOWS}
    Time: TFileTime;
    FileTime: LongRec;






|







 







|







 







>
>
|







780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
....
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
....
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
    /// compress (using the deflate method) a file, and add it to the zip file
    procedure AddDeflated(const aFileName: TFileName; RemovePath: boolean=true;
      CompressLevel: integer=6; ZipName: TFileName=''); overload;
    /// compress (using the deflate method) all files within a folder, and
    // add it to the zip file
    // - if Recursive is TRUE, would include files from nested sub-folders
    procedure AddFolder(const FolderName: TFileName; const Mask: TFileName=ZIP_FILES_ALL;
      Recursive: boolean=true; CompressLevel: integer=6; ZipFolder: TFileName='');
    /// release associated memory, and close destination file
    destructor Destroy; override;
  end;

  /// write-only access for creating a .zip archive into a stream
  TZipWriteToStream = class(TZipWriteAbstract)
  protected
................................................................................

procedure TZipWrite.InternalWrite(const buf; len: cardinal);
begin
  FileWrite(Handle,buf,len);
end;

procedure TZipWrite.AddFolder(const FolderName: TFileName; const Mask: TFileName;
  Recursive: boolean; CompressLevel: integer; ZipFolder: TFileName);
procedure RecursiveAdd(const fileDir,zipDir: TFileName);
var f: TSearchRec;
begin
  if Recursive then
    if FindFirst(fileDir+ZIP_FILES_ALL,faDirectory,f)=0 then begin
      repeat
        if f.Name[1]<>'.' then
................................................................................
        {$WARN SYMBOL_DEPRECATED ON}
        {$endif}
    until FindNext(f)<>0;
    FindClose(f);
  end;
end;
begin
  if ZipFolder<>'' then
    ZipFolder := IncludeTrailingPathDelimiter(ZipFolder);
  RecursiveAdd(IncludeTrailingPathDelimiter(FolderName),ZipFolder);
end;

procedure TZipWrite.AddDeflated(const aFileName: TFileName; RemovePath: boolean;
  CompressLevel: integer; ZipName: TFileName);
var {$ifdef MSWINDOWS}
    Time: TFileTime;
    FileTime: LongRec;

Changes to SynopseCommit.inc.

1
'1.18.6443'
|
1
'1.18.6444'