equal
deleted
inserted
replaced
144 end; |
144 end; |
145 |
145 |
146 procedure initModule; |
146 procedure initModule; |
147 var i: LongInt; |
147 var i: LongInt; |
148 cPhysfsId: shortstring; |
148 cPhysfsId: shortstring; |
149 fp: AnsiString; |
149 fp: PChar; |
150 begin |
150 begin |
151 {$IFDEF HWLIBRARY} |
151 {$IFDEF HWLIBRARY} |
152 //TODO: http://icculus.org/pipermail/physfs/2011-August/001006.html |
152 //TODO: http://icculus.org/pipermail/physfs/2011-August/001006.html |
153 cPhysfsId:= GetCurrentDir() + {$IFDEF DARWIN}{$IFNDEF IPHONEOS}'/Hedgewars.app/Contents/MacOS/' + {$ENDIF}{$ENDIF} ' hedgewars'; |
153 cPhysfsId:= GetCurrentDir() + {$IFDEF DARWIN}{$IFNDEF IPHONEOS}'/Hedgewars.app/Contents/MacOS/' + {$ENDIF}{$ENDIF} ' hedgewars'; |
154 {$ELSE} |
154 {$ELSE} |
157 |
157 |
158 i:= PHYSFS_init(Str2PChar(cPhysfsId)); |
158 i:= PHYSFS_init(Str2PChar(cPhysfsId)); |
159 AddFileLog('[PhysFS] init: ' + inttostr(i)); |
159 AddFileLog('[PhysFS] init: ' + inttostr(i)); |
160 |
160 |
161 // mount system fonts paths first |
161 // mount system fonts paths first |
162 fp := cFontsPaths; |
162 for i:= low(cFontsPaths) to high(cFontsPaths) do |
163 |
|
164 // let's remove paths from fp and mount them until nothing is left |
|
165 while length(fp) > 0 do |
|
166 begin |
163 begin |
167 AddFileLog('lol'); |
164 fp := cFontsPaths[i]; |
168 // search for ; |
165 if fp <> nil then |
169 i := pos(';', fp); |
166 pfsMount(fp, '/Fonts'); |
170 // if there is no ; left, read to end |
|
171 if i < 1 then |
|
172 i := length(fp) + 1; |
|
173 // don't mount empty path |
|
174 if i > 2 then |
|
175 pfsMount(copy(fp, 1, i-1), '/Fonts'); |
|
176 // remove mounted path from fp |
|
177 fp := copy(fp, i+1, length(fp)-i); |
|
178 end; |
167 end; |
179 |
168 |
180 pfsMountAtRoot(PathPrefix); |
169 pfsMountAtRoot(PathPrefix); |
181 pfsMountAtRoot(UserPathPrefix + '/Data'); |
170 pfsMountAtRoot(UserPathPrefix + '/Data'); |
182 |
171 |