--- a/hedgewars/uUtils.pas Fri Apr 29 15:10:27 2016 +0200
+++ b/hedgewars/uUtils.pas Fri Apr 29 18:18:32 2016 +0200
@@ -71,6 +71,7 @@
function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
function read1stLn(filePath: shortstring): shortstring;
+function readValueFromINI(key, filePath: shortstring): shortstring;
{$IFNDEF PAS2C}
procedure Write(var f: textfile; s: shortstring);
@@ -527,6 +528,37 @@
end;
end;
+function readValueFromINI(key, filePath: shortstring): shortstring;
+var f: pfsFile;
+ s: shortstring;
+ i: LongInt;
+begin
+ s:= '';
+ readValueFromINI:= '';
+
+ if pfsExists(filePath) then
+ begin
+ f:= pfsOpenRead(filePath);
+
+ while (not pfsEOF(f)) and allOK do
+ begin pfsReadLn(f, s);
+ if Length(s) = 0 then
+ continue;
+ if s[1] = ';' then
+ continue;
+
+ i:= Pos('=', s);
+ if Trim(Copy(s, 1, Pred(i))) = key then
+ begin
+ Delete(s, 1, i);
+ readValueFromINI:= s;
+ end;
+ end;
+ pfsClose(f);
+ f:= nil;
+ end;
+end;
+
procedure initModule(isNotPreview: boolean);
{$IFDEF DEBUGFILE}
var logfileBase: shortstring;