mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 15:49:40 +02:00
Patch from bug #21984: Improves FileSetDataUTF8
git-svn-id: trunk@37794 -
This commit is contained in:
parent
95709187d4
commit
6a3242c27d
@ -95,9 +95,36 @@ begin
|
||||
end;
|
||||
|
||||
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint;
|
||||
{$IFDEF Windows}
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
Function ADosTimeToWinTime (DosTime:longint;Var Wintime : TFileTime):longbool;
|
||||
var
|
||||
lft : TFileTime;
|
||||
begin
|
||||
ADosTimeToWinTime:=DosDateTimeToFileTime(longrec(DosTime).hi,longrec(DosTime).lo,@lft) and
|
||||
LocalFileTimeToFileTime(lft,Wintime);
|
||||
end;
|
||||
var
|
||||
FT:TFileTime;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF WINDOWS}
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
if (ADosTimeToWinTime(Age,FT) and
|
||||
SetFileTime(CreateFileW(PWideChar(UTF8ToUTF16(FileName)),
|
||||
FILE_WRITE_ATTRIBUTES,
|
||||
0, nil, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, 0),
|
||||
nil, nil, @FT)) then Exit;
|
||||
Result := GetLastError;
|
||||
{$else}
|
||||
Result:=SysUtils.FileSetDate(UTF8ToSys(Filename),Age);
|
||||
{$endif}
|
||||
{$ELSE}
|
||||
Result:=SysUtils.FileSetDate(UTF8ToSys(Filename),Age);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function ParamStrUTF8(Param: Integer): string;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user