ISPP: 'Rename' __FILE__ to __FILENAME__ and add __DIR__.

This commit is contained in:
Martijn Laan 2025-06-04 14:13:22 +02:00
parent d79b918b06
commit 1500ac811a
No known key found for this signature in database
GPG Key ID: E2DD568CF6098F6A
2 changed files with 6 additions and 2 deletions

View File

@ -1494,7 +1494,7 @@ function TPreprocessor.LookupPredefined(Name: string;
begin begin
Result := True; Result := True;
Name := UpperCase(Name); Name := UpperCase(Name);
if Name = '__FILE__' then if (Name = '__FILENAME__') or (Name = '__FILE__') then
begin begin
if Value <> nil then MakeStr(Value^, ExtractFileName(FIncludes[FCurrentFile])) if Value <> nil then MakeStr(Value^, ExtractFileName(FIncludes[FCurrentFile]))
end end
@ -1502,6 +1502,10 @@ begin
begin begin
if Value <> nil then MakeStr(Value^, FIncludes[FCurrentFile]) if Value <> nil then MakeStr(Value^, FIncludes[FCurrentFile])
end end
else if Name = '__DIR__' then
begin
if Value <> nil then MakeStr(Value^, ExtractFileDir(FIncludes[FCurrentFile]))
end
else if Name = '__LINE__' then else if Name = '__LINE__' then
begin begin
if Value <> nil then MakeInt(Value^, FCurrentLine) if Value <> nil then MakeInt(Value^, FCurrentLine)

View File

@ -3,5 +3,5 @@
// To ignore this change consider using Git's assume-unchanged or skip-worktree functionality // To ignore this change consider using Git's assume-unchanged or skip-worktree functionality
// //
[ISSigKeys] [ISSigKeys]
Name: mykey1; KeyID: def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38; KeyFile: {#ExtractFilePath(__PATHFILENAME__)}\def01.ispublickey Name: mykey1; KeyID: def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38; KeyFile: {#__DIR__}\def01.ispublickey
Name: mykey2; KeyID: def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5e7a28; PublicX: 515dc7d6c16d4a46272ceb3d158c5630a96466ab4d948e72c2029d737c823097; PublicY: f3c21f6b5156c52a35f6f28016ee3e31a3ded60c325b81fb7b1f88c221081a61 Name: mykey2; KeyID: def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5e7a28; PublicX: 515dc7d6c16d4a46272ceb3d158c5630a96466ab4d948e72c2029d737c823097; PublicY: f3c21f6b5156c52a35f6f28016ee3e31a3ded60c325b81fb7b1f88c221081a61