summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2015-07-23 14:29:32 +0200
committerErich Eckner <git@eckner.net>2015-07-23 14:29:32 +0200
commitc32e27b77d08e0583e55c9459e166924ab8840bd (patch)
treed74ba087c1b09399e8395d27f9a2cfec33f63b84
parentf37ed6b4a5487f57ddefd04b8ea830d647fa783c (diff)
downloadunits-c32e27b77d08e0583e55c9459e166924ab8840bd.tar.xz
shellSubst in systemunit.pas eingefuegt
-rw-r--r--systemunit.pas14
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;