mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:09:19 +02:00
FileUtil: inline FileSetDateUTF8 to use LazFileUtils.FileSetDateUTF8.
git-svn-id: trunk@41290 -
This commit is contained in:
parent
280b9f2060
commit
bdec439cd2
@ -64,6 +64,11 @@ begin
|
|||||||
Result := LazFileUtils.FileAgeUTF8(FileName);
|
Result := LazFileUtils.FileAgeUTF8(FileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint;
|
||||||
|
begin
|
||||||
|
Result := LazFileUtils.FileSetDateUTF8(FileName, Age);
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF darwin}
|
{$IFDEF darwin}
|
||||||
function GetDarwinSystemFilename(Filename: string): string;
|
function GetDarwinSystemFilename(Filename: string): string;
|
||||||
var
|
var
|
||||||
|
@ -222,7 +222,7 @@ function ExtractShortPathNameUTF8(Const FileName : String) : String;
|
|||||||
function FindFirstUTF8(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint;
|
function FindFirstUTF8(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint;
|
||||||
function FindNextUTF8(var Rslt: TSearchRec): Longint;
|
function FindNextUTF8(var Rslt: TSearchRec): Longint;
|
||||||
procedure FindCloseUTF8(var F: TSearchrec);
|
procedure FindCloseUTF8(var F: TSearchrec);
|
||||||
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint;
|
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint; inline;
|
||||||
function FileGetAttrUTF8(const FileName: String): Longint; inline;
|
function FileGetAttrUTF8(const FileName: String): Longint; inline;
|
||||||
function FileSetAttrUTF8(const Filename: String; Attr: longint): Longint; inline;
|
function FileSetAttrUTF8(const Filename: String; Attr: longint): Longint; inline;
|
||||||
function DeleteFileUTF8(const FileName: String): Boolean;
|
function DeleteFileUTF8(const FileName: String): Boolean;
|
||||||
|
@ -135,13 +135,7 @@ begin
|
|||||||
Result:=st.st_size;
|
Result:=st.st_size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
FileSetDateUTF8
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint;
|
|
||||||
begin
|
|
||||||
Result:=SysUtils.FileSetDate(UTF8ToSys(Filename),Age);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
GetFileDescription
|
GetFileDescription
|
||||||
|
@ -242,35 +242,6 @@ begin
|
|||||||
Windows.FindClose(FindHandle);
|
Windows.FindClose(FindHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
|
||||||
FileSetDateUTF8
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
{$ifndef WinCE}
|
|
||||||
function FileSetDateAnsi(const FileName: String; Age: Longint): Longint;
|
|
||||||
begin
|
|
||||||
Result:=SysUtils.FileSetDate(UTF8ToSys(Filename),Age);
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
function FileSetDateWide(const FileName: String; Age: Longint): Longint;
|
|
||||||
var
|
|
||||||
FT:TFileTime;
|
|
||||||
fh: HANDLE;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
fh := CreateFileW(PWideChar(UTF8ToUTF16(FileName)),
|
|
||||||
FILE_WRITE_ATTRIBUTES,
|
|
||||||
0, nil, OPEN_EXISTING,
|
|
||||||
FILE_ATTRIBUTE_NORMAL, 0);
|
|
||||||
if (fh <> feInvalidHandle) and (DosToWinTime(Age,FT) and SetFileTime(fh, nil, nil, @FT)) then
|
|
||||||
Result := 0
|
|
||||||
else
|
|
||||||
Result := GetLastError;
|
|
||||||
finally
|
|
||||||
if (fh <> feInvalidHandle) then FileClose(fh);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
FindFirstUTF8
|
FindFirstUTF8
|
||||||
@ -520,7 +491,6 @@ end;
|
|||||||
|
|
||||||
var
|
var
|
||||||
FileSize_ : function (const Filename: string): int64 = @FileSizeWide;
|
FileSize_ : function (const Filename: string): int64 = @FileSizeWide;
|
||||||
FileSetDate_ : function (const FileName: String; Age: Longint): Longint = @FileSetDateWide;
|
|
||||||
FindFirst_ : function (const Path: string; Attr: Longint;
|
FindFirst_ : function (const Path: string; Attr: Longint;
|
||||||
out Rslt: TSearchRec): Longint = @FindFirstWide;
|
out Rslt: TSearchRec): Longint = @FindFirstWide;
|
||||||
FindNext_ : function (var Rslt: TSearchRec): Longint = @FindNextWide;
|
FindNext_ : function (var Rslt: TSearchRec): Longint = @FindNextWide;
|
||||||
@ -540,10 +510,6 @@ begin
|
|||||||
Result:=FileSize_(FileName);
|
Result:=FileSize_(FileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileSetDateUTF8(const FileName: String; Age: Longint): Longint;
|
|
||||||
begin
|
|
||||||
Result:=FileSetDate_(FileName, Age);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function FindFirstUTF8(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint;
|
function FindFirstUTF8(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint;
|
||||||
begin
|
begin
|
||||||
@ -626,7 +592,6 @@ begin
|
|||||||
if Win32MajorVersion <= 4 then
|
if Win32MajorVersion <= 4 then
|
||||||
begin
|
begin
|
||||||
FileSize_:=@FileSizeAnsi;
|
FileSize_:=@FileSizeAnsi;
|
||||||
FileSetDate_:=@FileSetDateAnsi;
|
|
||||||
DeleteFile_:=@DeleteFileAnsi;
|
DeleteFile_:=@DeleteFileAnsi;
|
||||||
RenameFile_:=@RenameFileAnsi;
|
RenameFile_:=@RenameFileAnsi;
|
||||||
SetCurrentDir_:=@SetCurrentDirAnsi;
|
SetCurrentDir_:=@SetCurrentDirAnsi;
|
||||||
|
Loading…
Reference in New Issue
Block a user