Skip to content

Commit 309d4c2

Browse files
InfernioSharlikran
authored andcommitted
Disable 'Clean Data Directory' per game
Prerequisite for Enderal, otherwise it crashes on launch after using WB with it. Background: Enderal ships an empty folder called 'JCData', which JContainers requires in order to function - if it's removed, JContainers will crash the entire game. Normally, this folder contains some dummy files and example Lua scripts, which is why it never gets removed for standard JContainers installations. But Enderal, as already mentioned, ships it empty - JContainers is fine with this, but WB's 'Clean Data Directory' feature, which is enabled by default, will remove the folder, causing Enderal to crash. Things this commit does: 1. Rename it to 'Remove Empty Directories', because that's what it does. 2. Add a boolean that can force-disable it for a game and will also hide the toggle for it. TODO - flip the default to False and add a warning when it's flipped? Or even remove it altogether? This could cause issues with all kinds of mods that purposefully ship empty directories and expect them to exist.
1 parent 38687ff commit 309d4c2

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

Mopy/bash/basher/installers_links.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,10 @@ class Installers_AvoidOnStart(BoolLink):
425425

426426
class Installers_RemoveEmptyDirs(BoolLink):
427427
"""Toggles option to remove empty directories on file scan."""
428-
_text, key = _(u'Clean Data Directory'), 'bash.installers.removeEmptyDirs'
428+
_text = _(u'Remove Empty Directories')
429429
_help = _(u'Toggles whether or not Wrye Bash will remove empty '
430430
u'directories when scanning the Data folder.')
431+
key = 'bash.installers.removeEmptyDirs'
431432

432433
# Sorting Links
433434
class _Installer_Sort(ItemLink):

Mopy/bash/basher/links.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def InitInstallerLinks():
263263
InstallersList.mainMenu.append(Installers_AutoRefreshProjects())
264264
InstallersList.mainMenu.append(Installers_AutoRefreshBethsoft())
265265
InstallersList.mainMenu.append(Installers_BsaRedirection())
266-
InstallersList.mainMenu.append(Installers_RemoveEmptyDirs())
266+
if not bush.game.needs_empty_dirs:
267+
InstallersList.mainMenu.append(Installers_RemoveEmptyDirs())
267268
InstallersList.mainMenu.append(Installers_ConflictsReportShowsInactive())
268269
InstallersList.mainMenu.append(Installers_ConflictsReportShowsLower())
269270
InstallersList.mainMenu.append(

Mopy/bash/bosh/bain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,8 @@ def _refresh_from_data_dir(self, progress=None, recalculate_all_crcs=False):
19491949
new_sizeCrcDate, pending, pending_size = \
19501950
self._process_data_dir(dirDirsFiles, progress)
19511951
#--Remove empty dirs?
1952-
if bass.settings['bash.installers.removeEmptyDirs']:
1952+
if not bush.game.needs_empty_dirs and \
1953+
bass.settings['bash.installers.removeEmptyDirs']:
19531954
for empty in emptyDirs:
19541955
try: empty.removedirs()
19551956
except OSError: pass

Mopy/bash/game/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ class pnd(object):
227227
ignoreDataFiles = set()
228228
ignoreDataFilePrefixes = set()
229229
ignoreDataDirs = set()
230+
# Whether or not this game requires empty directories to be preserved. If
231+
# this is true, BAIN's 'Remove Empty Directories' function is disabled and
232+
# the toggle for it will not be shown.
233+
needs_empty_dirs = False
230234

231235
# Plugin format stuff
232236
class esp(object):

0 commit comments

Comments
 (0)