#1 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-24 15:35:59

Could you add the skippedFile functionality also to the AddFile() function?

function T7zWriter.AddFile(const Filename: TFileName; const ZipName: RawUtf8): string;
var
  item: T7zItem;
  Handle: THandle;
begin
  Handle := FileOpen(Filename, fmOpenReadDenyNone);
  if not ValidHandle(Handle) then
    exit;
  // result := ValidHandle(Handle);
  // if not result then
  //   exit;

  if IsFileReadable(Filename) then
   begin
    item := T7zItem.Create;
    item.SourceMode := smFile;
    item.FileName := Filename;
    item.ZipName := ZipName;
    GetFileTime(Handle, @item.CreationTime, nil, @item.LastWriteTime);
    item.Size := FileSize(Handle);
    CloseHandle(Handle);
    item.Attributes := GetFileAttributes(pointer(Filename));
    item.IsFolder := item.Attributes and faDirectory <> 0;
    item.IsAnti := false;
    item.Ownership := soOwned;
    item.UpdateItemIndex := -1;
    AddOrReplace(item);
   end
   else
     // notify the caller that this file is locked
     result := Filename;
end;

Maybe there could be a list, not a function result, in which AddFile() and AddFiles() add files to skip.
So when I use 100 times AddFile() (because I have my own list I go through to add files) then I would like to check only 1 files to skip list after these 100 AddFile() calls.

#2 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-11 16:50:06

Sorry I missunderstood something. In this other software you can just input something like x=20 or mt=4. This input is parsed and set later normally. So... nothing for the library.

#3 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-11 15:51:20

Thank you very much. Just wanted to know if this would be possible too

Maybe the ProgressCallback could result/send something once a file is done compressing or once a file has not been compressed due to an error. Like this in ProgressCallback we could catch these errors for logging.
it would be nice to have a more powerful ProgressCallback event. Is a file done compressing, did it work or not, which file has been compressed (name of it).

A more powerful OnProgress event would be so good!

Didn't fully understand about ssw switches and options like that in general. Is it possible to add that too?
Another software written in Delphi offers such an option to pass options like -ssw.

Passing custom parameters to the 7z.dll would also solve some problems users might get.

#4 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-10 18:30:38

Maybe the ProgressCallback could result/send something once a file is done compressing or once a file has not been compressed due to an error. Like this in ProgressCallback we could catch these errors for logging.
it would be nice to have a more powerful ProgressCallback event. Is a file done compressing, did it work or not, which file has been compressed (name of it).

#5 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-10 17:59:49

Encrypt Headers + Save (Level 0) and Copy mode works with JclCompression.

Tested it also with mORMot2:
- FileFormat > fh7z
- SetCompressionLevel > 0
- SetCompressionMethod7z > m7Copy
- SetPassword > password

Everything fine up to here, now add EncryptHeaders7z(True); and LZMA is applied.

Why I use mORMot2 and not JclCompression:
- it's being worked on - thank you so much for that!
- it's from france - me too... sort of
- it's better in my opinion
- many more reasons

#6 Re: mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-10 16:59:34

Thank you for your answer.

To 1) I will test that using mORMot2.
The behavior "compression stops when trying to compress a file in use/opened by another program" occurs when using JclCompression I think.

When using 7z GUI normally, everything is working as set in the options. I can set SAVE mode (0), Encrypt headers and a Password. The archive compression method is Copy instead of LZMA.
When using mORMot2, once you set a password or encrypt headers, LZMA is used.

#7 mORMot 2 » Unit mormot.lib.win7zip, support for -ssw switch and compression issue » 2023-05-10 15:39:03

WG42
Replies: 14

Currently I am refactoring my software to make use of mORMot2. I started years ago with TZipFile and moved later to Jedi JCL JclCompression.
mORMot2 works great so far, thank you for that.

1)
A user wrote me an email. Compressing files stops, when trying to add a file which is currently opened by another program.
When using the -ssw switch (I suppose he tried with 7z CLI) everything works fine.
> is it possible to add custom switch support? Or at least the -ssw switch for the moment so opened files can be compressed?

2)
When setting CompressionLevel to 0 (SAVE), CompressionMethod to m7Copy and setting up some more options to create an archiv, this archive gets created as expected in Save/Copy mode.
As soon as you add a password or encrypt headers, CompressionMethod will be set automatically to LZMA.

Board footer

Powered by FluxBB