diff options
author | Erich Eckner <git@eckner.net> | 2015-07-23 14:29:32 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-07-23 14:29:32 +0200 |
commit | c32e27b77d08e0583e55c9459e166924ab8840bd (patch) | |
tree | d74ba087c1b09399e8395d27f9a2cfec33f63b84 /systemunit.pas | |
parent | f37ed6b4a5487f57ddefd04b8ea830d647fa783c (diff) | |
download | units-c32e27b77d08e0583e55c9459e166924ab8840bd.tar.xz |
shellSubst in systemunit.pas eingefuegt
Diffstat (limited to 'systemunit.pas')
-rw-r--r-- | systemunit.pas | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/systemunit.pas b/systemunit.pas index 645f09e..220ab0f 100644 --- a/systemunit.pas +++ b/systemunit.pas @@ -12,6 +12,7 @@ function numCpus: int64; function momentanFreieCpus: int64; function belegterSpeicher: int64; function minCache: int64; +function shellSubst(s: string): string; implementation @@ -115,6 +116,19 @@ begin closefile(f); end; +function shellSubst(s: string): string; +var name: string; +begin + result:=s; + while pos('${',result)>0 do begin + s:=leftStr(result,pos('${',result)-1); + delete(result,1,pos('${',result)-1+length('${')); + name:=leftStr(result,pos('}',result)-1); + delete(result,1,length(name+'}')); + result:=s+GetEnvironmentVariable(name)+result; + end; +end; + begin _cpuLastUsed:=0; _cpuLastIdle:=0; |