Skip to content

Commit

Permalink
Fix Mac/Linux error if there are no 'normal' files are to be extracte…
Browse files Browse the repository at this point in the history
…d during an install
  • Loading branch information
drojf committed Jun 20, 2022
1 parent 430eca6 commit b8de4c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion higurashiInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ def moveFilesIntoPlace(self):
Moves files from the directory they were extracted to
to the game data folder
"""
# In some cases, the folders to be moved may not exist yet, so create them in advance
# This creates both the self.extractDir and the HigurashiEp0X subfolder
fromDataDir = os.path.join(self.extractDir, self.info.subModConfig.dataName)
try:
os.makedirs(fromDataDir)
except OSError:
pass

# On MacOS, the datadirectory has a different path than in the archive file:
#
# datadirectory in archive file : "Higurashi_Ep0X"
Expand All @@ -252,7 +260,7 @@ def moveFilesIntoPlace(self):
# To account for this, we rename the "Higurashi_Ep0X" folder to "Contents/Resources/Data" below
# (self.dataDirectory should equal "Contents/Resources/Data" on MacOS)
self._moveDirectoryIntoPlace(
fromDir = os.path.join(self.extractDir, self.info.subModConfig.dataName),
fromDir = fromDataDir,
toDir = self.dataDirectory,
log = True,
)
Expand Down

0 comments on commit b8de4c4

Please sign in to comment.