hedgewars/uPhysFSLayer.pas
branchflibqtfrontend
changeset 8363 0b4ac686fc44
parent 8310 a98c349bc06b
child 8330 aaefa587e277
child 8528 ffd71e99a4f0
--- a/hedgewars/uPhysFSLayer.pas	Tue Dec 18 20:48:37 2012 +0400
+++ b/hedgewars/uPhysFSLayer.pas	Fri Jan 04 21:44:40 2013 +0400
@@ -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);