Delphi 2009를 사용하여 특정 파일의 7z 아카이브를 만들려고합니다.JEDI의 JCLCompression을 사용하여 7z 아카이브를 만드는 방법은 무엇입니까?
아래 코드는 작동하지만 결과로 생성되는 7z 파일의 모든 항목의 크기는 0입니다. 아카이브에있는 파일 의 모든 파일은 정확하지만 0 크기가 아니어야합니다.
JCLCompression을 사용하여 7z 아카이브에 파일을 올바르게 추가하려면 어떻게해야합니까?
var
fname, archiveFileName: string;
arch: TJclUpdateArchive;
archiveclass: TJCLUpdateArchiveClass;
sr: TSearchRec;
begin
fname := GetDesktop + 'Support.7z';
archiveclass := GetArchiveFormats.FindUpdateFormat(fname);
if not Assigned(archiveclass) then
raise Exception.Create('Could not determine the Format of ' + fname);
arch := archiveclass.Create(fname);
try
with arch do
begin
if FindFirst(uFolder + '*.*', faAnyFile, sr) = 0 then
begin
repeat
AddFile(ExtractFileName(sr.Name), sr.Name);
until FindNext(sr) <> 0;
FindClose(sr);
end;
Compress;
end;
finally
arch.free;
end;
end;
+1 스키마에 감사드립니다. 다음과 같이 많은 시간을 절약 해주었습니다. :) –