mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 00:30:56 +02:00
* Enable use of EFS flag when zipping files
git-svn-id: trunk@44149 -
This commit is contained in:
parent
e7d2c93ca7
commit
981751b7fe
@ -72,7 +72,6 @@ Type
|
|||||||
Local_File_Header_Type = Packed Record //1 per zipped file
|
Local_File_Header_Type = Packed Record //1 per zipped file
|
||||||
Signature : LongInt; //4 bytes
|
Signature : LongInt; //4 bytes
|
||||||
Extract_Version_Reqd : Word; //if zip64: >= 45
|
Extract_Version_Reqd : Word; //if zip64: >= 45
|
||||||
{$warning TODO implement EFS/language enooding using UTF-8}
|
|
||||||
Bit_Flag : Word; //"General purpose bit flag in PKZip appnote
|
Bit_Flag : Word; //"General purpose bit flag in PKZip appnote
|
||||||
Compress_Method : Word;
|
Compress_Method : Word;
|
||||||
Last_Mod_Time : Word;
|
Last_Mod_Time : Word;
|
||||||
@ -434,6 +433,7 @@ Type
|
|||||||
FOnEndOfFile : TOnEndOfFileEvent;
|
FOnEndOfFile : TOnEndOfFileEvent;
|
||||||
FOnStartFile : TOnStartFileEvent;
|
FOnStartFile : TOnStartFileEvent;
|
||||||
FCurrentCompressor : TCompressor;
|
FCurrentCompressor : TCompressor;
|
||||||
|
FUseLanguageEncoding: Boolean;
|
||||||
function CheckEntries: Integer;
|
function CheckEntries: Integer;
|
||||||
procedure SetEntries(const AValue: TZipFileEntries);
|
procedure SetEntries(const AValue: TZipFileEntries);
|
||||||
Protected
|
Protected
|
||||||
@ -488,6 +488,8 @@ Type
|
|||||||
Property InMemSize : Int64 Read FInMemSize Write FInMemSize;
|
Property InMemSize : Int64 Read FInMemSize Write FInMemSize;
|
||||||
Property Entries : TZipFileEntries Read FEntries Write SetEntries;
|
Property Entries : TZipFileEntries Read FEntries Write SetEntries;
|
||||||
Property Terminated : Boolean Read FTerminated;
|
Property Terminated : Boolean Read FTerminated;
|
||||||
|
// EFS/language encoding using UTF-8
|
||||||
|
Property UseLanguageEncoding : Boolean Read FUseLanguageEncoding Write FUseLanguageEncoding;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFullZipFileEntry }
|
{ TFullZipFileEntry }
|
||||||
@ -1605,12 +1607,16 @@ function TZipper.UpdateZipHeader(Item: TZipFileEntry; FZip: TStream;
|
|||||||
var
|
var
|
||||||
IsZip64 : boolean; //Must the local header be in zip64 format?
|
IsZip64 : boolean; //Must the local header be in zip64 format?
|
||||||
// Separate from zip64 status of entire zip file.
|
// Separate from zip64 status of entire zip file.
|
||||||
ZFileName : String;
|
ZFileName : RawByteString;
|
||||||
Begin
|
Begin
|
||||||
ZFileName := Item.ArchiveFileName;
|
ZFileName := Item.ArchiveFileName;
|
||||||
IsZip64 := false;
|
IsZip64 := false;
|
||||||
With LocalHdr do
|
With LocalHdr do
|
||||||
begin
|
begin
|
||||||
|
if FUseLanguageEncoding then begin
|
||||||
|
SetCodePage(ZFileName, CP_UTF8, True);
|
||||||
|
Bit_Flag := Bit_Flag or EFS_LANGUAGE_ENCODING_FLAG;
|
||||||
|
end;
|
||||||
FileName_Length := Length(ZFileName);
|
FileName_Length := Length(ZFileName);
|
||||||
Crc32 := ACRC;
|
Crc32 := ACRC;
|
||||||
if LocalZip64Fld.Original_Size > 0 then
|
if LocalZip64Fld.Original_Size > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user