Browse Source

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

Martijn Laan 3 months ago
parent
commit
1500ac811a
2 changed files with 6 additions and 2 deletions
  1. 5 1
      Projects/Src/ISPP.Preprocessor.pas
  2. 1 1
      setup.allowedpublickeys.iss

+ 5 - 1
Projects/Src/ISPP.Preprocessor.pas

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

+ 1 - 1
setup.allowedpublickeys.iss

@@ -3,5 +3,5 @@
 // To ignore this change consider using Git's assume-unchanged or skip-worktree functionality
 //
 [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