mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 09:38:50 +01:00
codetools: added FileDateToDateTimeDef
git-svn-id: trunk@35085 -
This commit is contained in:
parent
916b25ac4d
commit
f9917204fc
@ -103,15 +103,13 @@ type
|
||||
FileTimeStamp: integer;
|
||||
end;
|
||||
|
||||
TCTDirectoryListingTime = longint;
|
||||
PCTDirectoryListingTime = ^TCTDirectoryListingTime;
|
||||
TCTDirectoryListingAttr = longint;
|
||||
PCTDirectoryListingAttr = ^TCTDirectoryListingAttr;
|
||||
TCTDirectoryListingSize = int64;
|
||||
PCTDirectoryListingSize = ^TCTDirectoryListingSize;
|
||||
|
||||
TCTDirectoryListingHeader = packed record
|
||||
Time: TCTDirectoryListingTime;
|
||||
Time: TCTFileAgeTime;
|
||||
Attr: TCTDirectoryListingAttr;
|
||||
Size: TCTDirectoryListingSize;
|
||||
end;
|
||||
@ -131,7 +129,7 @@ type
|
||||
procedure Clear;
|
||||
function CalcMemSize: PtrUInt;
|
||||
function GetFilename(Index: integer): PChar;
|
||||
function GetTime(Index: integer): TCTDirectoryListingTime;
|
||||
function GetTime(Index: integer): TCTFileAgeTime;
|
||||
function GetAttr(Index: integer): TCTDirectoryListingAttr;
|
||||
function GetSize(Index: integer): TCTDirectoryListingSize;
|
||||
end;
|
||||
@ -174,7 +172,7 @@ type
|
||||
function FindCompiledUnitInUnitSet(const AUnitName: string): string;
|
||||
function FindFile(const ShortFilename: string;
|
||||
const FileCase: TCTSearchFileCase): string;
|
||||
function FileAge(const ShortFilename: string): TCTDirectoryListingTime;
|
||||
function FileAge(const ShortFilename: string): TCTFileAgeTime;
|
||||
function FileAttr(const ShortFilename: string): TCTDirectoryListingAttr;
|
||||
function FileSize(const ShortFilename: string): TCTDirectoryListingSize;
|
||||
function FindUnitSource(const AUnitName: string; AnyCase: boolean): string;
|
||||
@ -235,7 +233,7 @@ type
|
||||
procedure IncreaseFileTimeStamp; inline;
|
||||
procedure IncreaseConfigTimeStamp; inline;
|
||||
function FileExists(Filename: string): boolean;
|
||||
function FileAge(Filename: string): TCTDirectoryListingTime;
|
||||
function FileAge(Filename: string): TCTFileAgeTime;
|
||||
function FileAttr(Filename: string): TCTDirectoryListingAttr;
|
||||
function FileSize(Filename: string): TCTDirectoryListingSize;
|
||||
function FindUnitInUnitLinks(const Directory, AUnitName: string): string;
|
||||
@ -930,7 +928,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCTDirectoryCache.FileAge(const ShortFilename: string
|
||||
): TCTDirectoryListingTime;
|
||||
): TCTFileAgeTime;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -1472,7 +1470,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCTDirectoryCachePool.FileAge(Filename: string
|
||||
): TCTDirectoryListingTime;
|
||||
): TCTFileAgeTime;
|
||||
var
|
||||
Directory: String;
|
||||
Cache: TCTDirectoryCache;
|
||||
@ -1779,7 +1777,7 @@ begin
|
||||
Result:=@Files[Starts[Index]+NameOffset];
|
||||
end;
|
||||
|
||||
function TCTDirectoryListing.GetTime(Index: integer): TCTDirectoryListingTime;
|
||||
function TCTDirectoryListing.GetTime(Index: integer): TCTFileAgeTime;
|
||||
|
||||
procedure RaiseIndexOutOfBounds;
|
||||
begin
|
||||
|
||||
@ -76,6 +76,8 @@ type
|
||||
ctsfcLoUpCase, // also search for lower and upper case
|
||||
ctsfcAllCase // search case insensitive
|
||||
);
|
||||
TCTFileAgeTime = longint;
|
||||
PCTFileAgeTime = ^TCTFileAgeTime;
|
||||
|
||||
function CompareFilenames(const Filename1, Filename2: string): integer; inline;
|
||||
function CompareFilenamesIgnoreCase(const Filename1, Filename2: string): integer; inline;
|
||||
@ -130,6 +132,7 @@ function SetCurrentDirUTF8(const NewDir: String): Boolean; inline;
|
||||
function CreateDirUTF8(const NewDir: String): Boolean; inline;
|
||||
function RemoveDirUTF8(const Dir: String): Boolean; inline;
|
||||
function ForceDirectoriesUTF8(const Dir: string): Boolean; inline;
|
||||
function FileDateToDateTimeDef(aFileDate: TCTFileAgeTime; const Default: TDateTime): TDateTime;
|
||||
|
||||
function ClearFile(const Filename: string; RaiseOnError: boolean): boolean;
|
||||
function GetTempFilename(const Path, Prefix: string): string;
|
||||
@ -646,6 +649,16 @@ begin
|
||||
Result:=LazFileUtils.ForceDirectoriesUTF8(Dir);
|
||||
end;
|
||||
|
||||
function FileDateToDateTimeDef(aFileDate: TCTFileAgeTime; const Default: TDateTime
|
||||
): TDateTime;
|
||||
begin
|
||||
try
|
||||
Result:=FileDateToDateTime(aFileDate);
|
||||
except
|
||||
Result:=Default;
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
function ClearFile(const Filename: string; RaiseOnError: boolean): boolean;
|
||||
-------------------------------------------------------------------------------}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user