diff options
Diffstat (limited to 'systemunit.pas')
-rw-r--r-- | systemunit.pas | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/systemunit.pas b/systemunit.pas index f511f87..408fc19 100644 --- a/systemunit.pas +++ b/systemunit.pas @@ -12,7 +12,7 @@ function numCpus: int64; function momentanFreieCpus: int64; function belegterSpeicher: int64; function minCache: int64; -function shellSubst(s: string): string; +function shellSubst(s: string; env: tMyStringList = nil): string; function homeVerzeichnis: string; overload; function homeVerzeichnis(user: string): string; overload; function shellExpand(s: string): string; overload; @@ -125,15 +125,26 @@ begin closeFile(f); end; -function shellSubst(s: string): string; +function shellSubst(s: string; env: tMyStringList = nil): string; var - name: string; + name: string; + i: longint; + gefunden: boolean; begin result:=''; while pos('${',s)>0 do begin result:=result+erstesArgument(s,'${',false); name:=erstesArgument(s,'}',false); - result:=result+getEnvironmentVariable(name); + gefunden:=false; + if assigned(env) then + for i:=0 to env.count-1 do + if leftStr(env[i],length(s)+1) = s+'=' then begin + result:=result+rightStr(env[i],length(env[i])-length(s)-1); + gefunden:=true; + break; + end; + if not gefunden then + result:=result+getEnvironmentVariable(name); end; result:=result+s; end; |