Bit more reusability
authornemo
Sun, 12 Jun 2011 22:34:38 -0400
changeset 5239 f34f391a223b
parent 5238 46ddaf14509d
child 5240 9135c1905415
Bit more reusability
hedgewars/ArgParsers.inc
hedgewars/hwengine.pas
hedgewars/uMisc.pas
hedgewars/uSound.pas
hedgewars/uUtils.pas
--- a/hedgewars/ArgParsers.inc	Sun Jun 12 21:06:48 2011 -0400
+++ b/hedgewars/ArgParsers.inc	Sun Jun 12 22:34:38 2011 -0400
@@ -34,7 +34,7 @@
 procedure internalStartGameWithParameters();
 var tmp: LongInt;
 begin
-    UserPathPrefix:= ParamStr(1)+'/Data';
+    UserPathPrefix:= ParamStr(1);
     val(ParamStr(2), cScreenWidth);
     val(ParamStr(3), cScreenHeight);
     val(ParamStr(4), cBits);
@@ -147,7 +147,7 @@
 var paramIndex: LongInt;
     wrongParameter: boolean;
 begin
-    UserPathPrefix:= ParamStr(1)+'/Data';
+    UserPathPrefix:= ParamStr(1);
     PathPrefix:= ParamStr(2);
     recordFileName:= ParamStr(3);
     paramIndex:= 4;
--- a/hedgewars/hwengine.pas	Sun Jun 12 21:06:48 2011 -0400
+++ b/hedgewars/hwengine.pas	Sun Jun 12 22:34:38 2011 -0400
@@ -214,7 +214,7 @@
     cFullScreen:= false;
     cTimerInterval:= 8;
     PathPrefix:= 'Data';
-    UserPathPrefix:= 'Data';
+    UserPathPrefix:= '.';
     cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF};
     val(gameArgs[0], ipcPort);
     val(gameArgs[1], cScreenWidth);
@@ -240,7 +240,7 @@
         AddFileLog(inttostr(i) + ': ' + ParamStr(i));
 
     for p:= Succ(Low(TPathType)) to High(TPathType) do
-        if p <> ptMapCurrent then UserPathz[p]:= UserPathPrefix + '/' + Pathz[p];
+        if p <> ptMapCurrent then UserPathz[p]:= UserPathPrefix + '/Data/' + Pathz[p];
 
     for p:= Succ(Low(TPathType)) to High(TPathType) do
         if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
--- a/hedgewars/uMisc.pas	Sun Jun 12 21:06:48 2011 -0400
+++ b/hedgewars/uMisc.pas	Sun Jun 12 22:34:38 2011 -0400
@@ -79,7 +79,7 @@
 
 // update header information and file name
 
-filename:= ParamStr(1) + '/Screenshots/' + filename + '.bmp';
+filename:= UserPathPrefix + '/Screenshots/' + filename + '.bmp';
 
 head[$02]:= (size + 54) and $ff;
 head[$03]:= ((size + 54) shr 8) and $ff;
--- a/hedgewars/uSound.pas	Sun Jun 12 21:06:48 2011 -0400
+++ b/hedgewars/uSound.pas	Sun Jun 12 22:34:38 2011 -0400
@@ -375,7 +375,7 @@
     if (not isSoundEnabled) or (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    s:= UserPathPrefix + '/Music/' + MusicFN;
+    s:= UserPathPrefix + '/Data/Music/' + MusicFN;
     if not FileExists(s) then s:= PathPrefix + '/Music/' + MusicFN;
     WriteToConsole(msgLoading + s + ' ');
 
--- a/hedgewars/uUtils.pas	Sun Jun 12 21:06:48 2011 -0400
+++ b/hedgewars/uUtils.pas	Sun Jun 12 22:34:38 2011 -0400
@@ -359,7 +359,7 @@
             i:= 0;
             while(i < 7) do
             begin
-                assign(f, ParamStr(1) + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
+                assign(f, UserPathPrefix + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
                 rewrite(f);
                 if IOResult = 0 then break;
                 inc(i)