mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 14:19:22 +02:00
LazFileUtils: inline FileAgeUTF8 to LazFileUtils.FileAgeUTF8
git-svn-id: trunk@41288 -
This commit is contained in:
parent
486d00d68c
commit
d1e6e77a05
@ -59,6 +59,11 @@ begin
|
|||||||
Result := LazFileUtils.DirectoryExistsUTF8(Directory);
|
Result := LazFileUtils.DirectoryExistsUTF8(Directory);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FileAgeUTF8(const FileName: string): Longint;
|
||||||
|
begin
|
||||||
|
Result := LazFileUtils.FileAgeUTF8(FileName);
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF darwin}
|
{$IFDEF darwin}
|
||||||
function GetDarwinSystemFilename(Filename: string): string;
|
function GetDarwinSystemFilename(Filename: string): string;
|
||||||
var
|
var
|
||||||
|
@ -214,7 +214,7 @@ function UTF8ToConsole(const s: string): string;// converts UTF8 string to conso
|
|||||||
|
|
||||||
// file operations
|
// file operations
|
||||||
function FileExistsUTF8(const Filename: string): boolean; inline;
|
function FileExistsUTF8(const Filename: string): boolean; inline;
|
||||||
function FileAgeUTF8(const FileName: string): Longint;
|
function FileAgeUTF8(const FileName: string): Longint; inline;
|
||||||
function DirectoryExistsUTF8(const Directory: string): Boolean; inline;
|
function DirectoryExistsUTF8(const Directory: string): Boolean; inline;
|
||||||
function ExpandFileNameUTF8(const FileName: string): string; inline;
|
function ExpandFileNameUTF8(const FileName: string): string; inline;
|
||||||
function ExpandUNCFileNameUTF8(const FileName: string): string;
|
function ExpandUNCFileNameUTF8(const FileName: string): string;
|
||||||
|
@ -122,13 +122,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
FileAgeUTF8
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function FileAgeUTF8(const FileName: String): Longint;
|
|
||||||
begin
|
|
||||||
Result:=SysUtils.FileAge(UTF8ToSys(Filename));
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
FileSize
|
FileSize
|
||||||
|
@ -173,9 +173,6 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
|
||||||
function FileAgeUTF8(const FileName: String): Longint;
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
|
|
||||||
function WinToDosTime (Var Wtime : TFileTime;var DTime:longint):longbool;
|
function WinToDosTime (Var Wtime : TFileTime;var DTime:longint):longbool;
|
||||||
var
|
var
|
||||||
@ -199,29 +196,6 @@ begin
|
|||||||
LocalFileTimeToFileTime(lft,Wintime); ;
|
LocalFileTimeToFileTime(lft,Wintime); ;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifndef WinCE}
|
|
||||||
function FileAgeAnsi(const FileName: String): Longint;
|
|
||||||
begin
|
|
||||||
Result:=SysUtils.FileAge(UTF8ToSys(Filename));
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
function FileAgeWide(const FileName: String): Longint;
|
|
||||||
var
|
|
||||||
Hnd: THandle;
|
|
||||||
FindData: TWin32FindDataW;
|
|
||||||
begin
|
|
||||||
Hnd := FindFirstFileW(PWideChar(UTF8ToUTF16(FileName)), FindData);
|
|
||||||
if Hnd <> INVALID_HANDLE_VALUE then
|
|
||||||
begin
|
|
||||||
Windows.FindClose(Hnd);
|
|
||||||
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
|
|
||||||
If WinToDosTime(FindData.ftLastWriteTime,Result) then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
Result := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
FileSize
|
FileSize
|
||||||
@ -545,7 +519,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
FileAge_ : function (const Filename:string):Longint = @FileAgeWide;
|
|
||||||
FileSize_ : function (const Filename: string): int64 = @FileSizeWide;
|
FileSize_ : function (const Filename: string): int64 = @FileSizeWide;
|
||||||
FileSetDate_ : function (const FileName: String; Age: Longint): Longint = @FileSetDateWide;
|
FileSetDate_ : function (const FileName: String; Age: Longint): Longint = @FileSetDateWide;
|
||||||
FindFirst_ : function (const Path: string; Attr: Longint;
|
FindFirst_ : function (const Path: string; Attr: Longint;
|
||||||
@ -560,10 +533,7 @@ var
|
|||||||
RemoveDir_ : function (const Dir: String): Boolean = @RemoveDirWide;
|
RemoveDir_ : function (const Dir: String): Boolean = @RemoveDirWide;
|
||||||
|
|
||||||
|
|
||||||
function FileAgeUTF8(const FileName: String): Longint;
|
|
||||||
begin
|
|
||||||
Result:=FileAge_(FileName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function FileSize(const Filename: string): int64;
|
function FileSize(const Filename: string): int64;
|
||||||
begin
|
begin
|
||||||
@ -655,7 +625,6 @@ begin
|
|||||||
{$ifndef WinCE}
|
{$ifndef WinCE}
|
||||||
if Win32MajorVersion <= 4 then
|
if Win32MajorVersion <= 4 then
|
||||||
begin
|
begin
|
||||||
FileAge_:=@FileAgeAnsi;
|
|
||||||
FileSize_:=@FileSizeAnsi;
|
FileSize_:=@FileSizeAnsi;
|
||||||
FileSetDate_:=@FileSetDateAnsi;
|
FileSetDate_:=@FileSetDateAnsi;
|
||||||
DeleteFile_:=@DeleteFileAnsi;
|
DeleteFile_:=@DeleteFileAnsi;
|
||||||
|
Loading…
Reference in New Issue
Block a user