@@ -243,22 +243,42 @@ def moveFilesIntoPlace(self):
243
243
Moves files from the directory they were extracted to
244
244
to the game data folder
245
245
"""
246
+ # On MacOS, the datadirectory has a different path than in the archive file:
247
+ #
248
+ # datadirectory in archive file : "Higurashi_Ep0X"
249
+ # datadirectory on Linux/Windows: "Higurashi_Ep0X"
250
+ # datadirectory on Macos: "Contents/Resources/Data"
251
+ #
252
+ # To account for this, we rename the "Higurashi_Ep0X" folder to "Contents/Resources/Data" below
253
+ # (self.dataDirectory should equal "Contents/Resources/Data" on MacOS)
246
254
self ._moveDirectoryIntoPlace (
247
255
fromDir = os .path .join (self .extractDir , self .info .subModConfig .dataName ),
248
- toDir = self .dataDirectory
256
+ toDir = self .dataDirectory ,
257
+ log = True ,
249
258
)
259
+
250
260
if common .Globals .IS_WINDOWS :
251
261
exePath = self .info .subModConfig .dataName [:- 5 ] + ".exe"
252
262
self ._moveFileIntoPlace (
253
263
fromPath = os .path .join (self .extractDir , exePath ),
254
264
toPath = os .path .join (self .directory , exePath ),
265
+ log = True ,
255
266
)
256
267
elif common .Globals .IS_MAC :
257
268
self ._moveFileIntoPlace (
258
269
fromPath = os .path .join (self .extractDir , "Contents/Resources/PlayerIcon.icns" ),
259
- toPath = os .path .join (self .directory , "Contents/Resources/PlayerIcon.icns" )
270
+ toPath = os .path .join (self .directory , "Contents/Resources/PlayerIcon.icns" ),
271
+ log = True ,
260
272
)
261
273
274
+ # If any files still remain, just move them directly into the game directory,
275
+ # keeping the same folder structure as inside the archive
276
+ self ._moveDirectoryIntoPlace (
277
+ fromDir = self .extractDir ,
278
+ toDir = self .directory ,
279
+ log = True ,
280
+ )
281
+
262
282
def _applyLanguageSpecificSharedAssets (self , folderToApply ):
263
283
"""Helper function which applies language specific assets.
264
284
Returns False if there was an error during the proccess.
@@ -322,11 +342,14 @@ def applyLanguagePatchFixesIfNecessary(self):
322
342
'this error so we can fix it:\n \n '
323
343
'"Invalid Language Specific Asset files found: {}"' .format (invalidUIFileList ))
324
344
325
- def _moveDirectoryIntoPlace (self , fromDir , toDir ):
326
- # type: (str, str) -> None
345
+ def _moveDirectoryIntoPlace (self , fromDir , toDir , log = False ):
346
+ # type: (str, str, Optional[bool] ) -> None
327
347
"""
328
348
Recursive function that does the actual moving for `moveFilesIntoPlace`
329
349
"""
350
+ if log :
351
+ print ("_moveDirectoryIntoPlace: '{}' -> '{}'" .format (fromDir , toDir ))
352
+
330
353
for file in os .listdir (fromDir ):
331
354
src = path .join (fromDir , file )
332
355
target = path .join (toDir , file )
@@ -340,11 +363,14 @@ def _moveDirectoryIntoPlace(self, fromDir, toDir):
340
363
shutil .move (src , target )
341
364
forceRemoveDir (fromDir )
342
365
343
- def _moveFileIntoPlace (self , fromPath , toPath ):
344
- # type: (str, str) -> None
366
+ def _moveFileIntoPlace (self , fromPath , toPath , log = False ):
367
+ # type: (str, str, Optional[bool] ) -> None
345
368
"""
346
369
Moves a single file from `fromPath` to `toPath`
347
370
"""
371
+ if log :
372
+ print ("_moveFileIntoPlace: '{}' -> '{}'" .format (fromPath , toPath ))
373
+
348
374
if path .exists (fromPath ):
349
375
if path .exists (toPath ):
350
376
forceRemove (toPath )
0 commit comments