Add new substitute_env_variables parameter for DefaultReplacements function (with default true value)

This commit is contained in:
Pierre Muller 2023-06-05 11:46:44 +02:00
parent add67ca0e3
commit 627fd6bce1

View File

@ -653,7 +653,7 @@ interface
function getrealtime(const st: TSystemTime) : real;
function getrealtime : real;
procedure DefaultReplacements(var s:ansistring);
procedure DefaultReplacements(var s:ansistring; substitute_env_variables:boolean=true);
function GetEnvPChar(const envname:ansistring):pchar;
procedure FreeEnvPChar(p:pchar);
@ -952,7 +952,7 @@ implementation
****************************************************************************}
procedure DefaultReplacements(var s:ansistring);
procedure DefaultReplacements(var s:ansistring; substitute_env_variables:boolean=true);
{$ifdef mswindows}
procedure ReplaceSpecialFolder(const MacroName: string; const ID: integer);
begin
@ -1024,6 +1024,8 @@ implementation
Replace(s,'$OPENBSD_LOCALBASE',GetOpenBSDLocalBase);
Replace(s,'$OPENBSD_X11BASE',GetOpenBSDX11Base);
{$endif openbsd}
if not substitute_env_variables then
exit;
{ Replace environment variables between dollar signs }
i := pos('$',s);
while i>0 do