Просмотр исходного кода

* enable to check the existing of environment variables in config files

florian 2 лет назад
Родитель
Сommit
163774780e
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      compiler/options.pas

+ 10 - 2
compiler/options.pas

@@ -3503,7 +3503,11 @@ begin
                   stopOptions(1);
                   stopOptions(1);
                 end;
                 end;
                inc(Level);
                inc(Level);
-               skip[level]:=(skip[level-1] or not defined_macro(upper(GetName(opts))));
+               { environment variable? }
+               if (opts[1]='$') and (opts[length(opts)]='$') then
+                 skip[level]:=skip[level-1] or (GetEnvironmentVariable(copy(opts,2,length(opts)-2))='')
+               else
+                 skip[level]:=(skip[level-1] or not defined_macro(upper(GetName(opts))));
              end
              end
            else
            else
             if (s='IFNDEF') then
             if (s='IFNDEF') then
@@ -3515,7 +3519,11 @@ begin
                   stopOptions(1);
                   stopOptions(1);
                 end;
                 end;
                inc(Level);
                inc(Level);
-               skip[level]:=(skip[level-1] or defined_macro(upper(GetName(opts))));
+               { environment variable? }
+               if (opts[1]='$') and (opts[length(opts)]='$') then
+                 skip[level]:=skip[level-1] or (GetEnvironmentVariable(copy(opts,2,length(opts)-2))<>'')
+               else
+                 skip[level]:=skip[level-1] or defined_macro(upper(GetName(opts)));
              end
              end
            else
            else
             if (s='ELSE') then
             if (s='ELSE') then