Recent

Author Topic: Abbrevia Freshenfiles problem  (Read 2102 times)

JanRoza

  • Hero Member
  • *****
  • Posts: 605
    • http://www.silentwings.nl
Abbrevia Freshenfiles problem
« on: March 14, 2014, 12:05:10 pm »
I'm having trouble getting Abbrevia's FreshenFiles function to work.

I'm using this code and via debugging and the ShowMessage I see that FreshenFiles is being called (see screenshot) but still the archive is never refreshed or updated.
Does anyone have any tips or suggestions how i can get thsi to work properly?

Code: [Select]
iArchiveDate := FileAge(strZipFile);

Zip := TAbZipper.Create(nil);
Zip.FileName := strZipFile;

if bDifferential
then begin 
     for i := 0 to lstFilteredFiles.Count - 1 do
     begin
       if FileAge(lstFilteredFiles[i]) > iArchiveDate
       then begin
            showmessage('Freshening archive ' + strZipFile + ' for file ' + lstFilteredFiles[i]);
            Zip.FreshenFiles(lstFilteredFiles[i]);
       end;
     end;

     Zip.Save;
     Zip.Free;
end;

« Last Edit: March 14, 2014, 12:06:50 pm by JanRoza »
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.10 FPC 3.2.0
       CodeTyphon 7.3 FPC 3.3.1

JanRoza

  • Hero Member
  • *****
  • Posts: 605
    • http://www.silentwings.nl
Re: Abbrevia Freshenfiles problem
« Reply #1 on: March 16, 2014, 12:56:54 am »
Problem solved.
It turned out I hadn't set Zip.BaseDirectory which causes a mismatch in every filename.
I added

Code: [Select]
Zip.BaseDirectory := ExtractFileDrive(lstFilteredFiles[i]) + '\';

to set the drive (for instance E:\) as BaseDirectory and now FreshenFiles works like it should.
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.10 FPC 3.2.0
       CodeTyphon 7.3 FPC 3.3.1

 

TinyPortal © 2005-2018