hedgewars/uPhysFSLayer.pas
changeset 8310 a98c349bc06b
parent 8283 af97cdbb7713
child 8330 aaefa587e277
child 8528 ffd71e99a4f0
--- a/hedgewars/uPhysFSLayer.pas	Mon Dec 17 00:43:52 2012 +0100
+++ b/hedgewars/uPhysFSLayer.pas	Tue Dec 18 03:07:45 2012 +0100
@@ -40,7 +40,7 @@
 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhysfsLibName;
 
 implementation
-uses uUtils, uVariables;
+uses uUtils, uVariables, sysutils;
 
 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName;
 function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName;
@@ -135,8 +135,16 @@
 
 procedure initModule;
 var i: LongInt;
+    cPhysfsId: shortstring;
 begin
-    i:= PHYSFS_init(Str2PChar(ParamStr(0)));
+{$IFDEF HWLIBRARY}
+    //TODO: http://icculus.org/pipermail/physfs/2011-August/001006.html
+    cPhysfsId:= GetCurrentDir() + {$IFDEF DARWIN}'/Hedgewars.app/Contents/MacOS/' + {$ENDIF} ' hedgewars';
+{$ELSE}
+    cPhysfsId:= ParamStr(0);
+{$ENDIF}
+
+    i:= PHYSFS_init(Str2PChar(cPhysfsId));
     AddFileLog('[PhysFS] init: ' + inttostr(i));
 
     i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true);