Pass paths to initModule of uPhysFSLayer (as in 4be6cd55f1cf from qmlfrontend branch)
authorunc0rr
Tue, 29 Mar 2016 22:00:34 +0300
changeset 11631 b3db79b56f28
parent 11629 c2e6df2cfac7
child 11632 cac74d9075be
Pass paths to initModule of uPhysFSLayer (as in 4be6cd55f1cf from qmlfrontend branch)
hedgewars/hwengine.pas
hedgewars/uPhysFSLayer.pas
--- a/hedgewars/hwengine.pas	Tue Mar 29 16:54:07 2016 +0200
+++ b/hedgewars/hwengine.pas	Tue Mar 29 22:00:34 2016 +0300
@@ -465,7 +465,13 @@
     uLand.initModule;               // computes land
     uLandPainted.initModule;        // computes drawn land
     uIO.initModule;                 // sets up sockets
-    uPhysFSLayer.initModule;
+
+    PathPrefix:= PathPrefix + #0;
+    UserPathPrefix:= UserPathPrefix + #0;
+    uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
+    PathPrefix:= copy(PathPrefix, 1, length(PathPrefix) - 1);
+    UserPathPrefix:= copy(UserPathPrefix, 1, length(UserPathPrefix) - 1);
+
     uScript.initModule;
 
     if complete then
--- a/hedgewars/uPhysFSLayer.pas	Tue Mar 29 16:54:07 2016 +0200
+++ b/hedgewars/uPhysFSLayer.pas	Tue Mar 29 22:00:34 2016 +0300
@@ -13,7 +13,7 @@
     {$linklib physlayer}
 {$ENDIF}
 
-procedure initModule;
+procedure initModule(localPrefix, userPrefix: PChar);
 procedure freeModule;
 
 type PFSFile = pointer;
@@ -138,9 +138,9 @@
 procedure pfsMount(path: ansistring; mountpoint: PChar);
 begin
     if PHYSFS_mount(PChar(path), mountpoint, false) then
-        AddFileLog('[PhysFS] mount ' + shortstring(path) + ' at ' + shortstring(mountpoint) + ' : ok')
+        //AddFileLog('[PhysFS] mount ' + shortstring(path) + ' at ' + shortstring(mountpoint) + ' : ok')
     else
-        AddFileLog('[PhysFS] mount ' + shortstring(path) + ' at ' + shortstring(mountpoint) + ' : FAILED ("' + shortstring(PHYSFS_getLastError()) + '")');
+        //AddFileLog('[PhysFS] mount ' + shortstring(path) + ' at ' + shortstring(mountpoint) + ' : FAILED ("' + shortstring(PHYSFS_getLastError()) + '")');
 end;
 
 procedure pfsMountAtRoot(path: ansistring);
@@ -148,7 +148,7 @@
     pfsMount(path, PChar(_S'/'));
 end;
 
-procedure initModule;
+procedure initModule(localPrefix, userPrefix: PChar);
 var i: LongInt;
     cPhysfsId: shortstring;
 {$IFNDEF MOBILE}
@@ -171,17 +171,17 @@
         begin
             fp := cFontsPaths[i];
             if fp <> nil then
-                pfsMount(ansistring(fp), PChar('/Fonts'));
+                pfsMount(ansistring(fp), _P'/Fonts');
         end;
 {$ENDIF}
 
-    pfsMountAtRoot(PathPrefix);
-    pfsMountAtRoot(UserPathPrefix + ansistring('/Data'));
+    pfsMountAtRoot(localPrefix);
+    pfsMountAtRoot(userPrefix + ansistring('/Data'));
 
     hedgewarsMountPackages;
 
     // need access to teams and frontend configs (for bindings)
-    pfsMountAtRoot(UserPathPrefix);
+    pfsMountAtRoot(userPrefix);
 
     if cTestLua then
         begin