Skip to content

Commit 89e589d

Browse files
committed
bain: Notify bsaInfos on install
Since the LO methods right below will check for missing strings, but a plugin's BSA may not have been added to the cache yet, you'd get bogus 'missing strings' warnings when installing a localized plugin. Could issue a full refresh to fix this, but I decided to do it (hopefully?) properly, by making the install methods return a set of all BSAs. Will probably be needed for the BSAs tab anyways (see refresh_ui) and is definitely much more efficient than ordering a full BSA refresh.
1 parent 037749f commit 89e589d

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

Mopy/bash/bosh/bain.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ def install(self, destFiles, progress=None):
10291029
dest_src = self.refreshDataSizeCrc(True)
10301030
for k in dest_src.keys():
10311031
if k not in destFiles: del dest_src[k]
1032-
if not dest_src: return bolt.LowerDict(), set(), set()
1032+
if not dest_src: return bolt.LowerDict(), set(), set(), set()
10331033
progress = progress if progress else bolt.Progress()
10341034
return self._install(dest_src, progress)
10351035

@@ -1044,16 +1044,20 @@ def _fs_install(self, dest_src, srcDirJoin, progress,
10441044
norm_ghostGet = norm_ghost.get
10451045
data_sizeCrcDate_update = bolt.LowerDict()
10461046
data_sizeCrc = self.ci_dest_sizeCrc
1047-
mods, inis = set(), set()
1047+
mods, inis, bsas = set(), set(), set()
10481048
source_paths, dests = [], []
1049+
bsa_ext = u'.' + bush.game.bsa_extension
10491050
for dest, src in dest_src.iteritems():
10501051
size,crc = data_sizeCrc[dest]
10511052
srcFull = srcDirJoin(src)
10521053
destFull = bass.dirs['mods'].join(norm_ghostGet(dest, dest))
1053-
if srcFull.tail in self.espms:
1054-
mods.add(srcFull.tail)
1054+
src_tail = srcFull.tail
1055+
if src_tail in self.espms:
1056+
mods.add(src_tail)
10551057
elif InstallersData._is_ini_tweak(dest):
1056-
inis.add(srcFull.tail)
1058+
inis.add(src_tail)
1059+
elif srcFull.cext == bsa_ext:
1060+
bsas.add(src_tail)
10571061
data_sizeCrcDate_update[dest] = (size, crc, -1) ##: HACK we must try avoid stat'ing the mtime
10581062
source_paths.append(srcFull)
10591063
dests.append(destFull)
@@ -1067,7 +1071,7 @@ def _fs_install(self, dest_src, srcDirJoin, progress,
10671071
#--Clean up unpack dir if we're an archive
10681072
if unpackDir: bass.rmTempDir()
10691073
#--Update Installers data
1070-
return data_sizeCrcDate_update, mods, inis
1074+
return data_sizeCrcDate_update, mods, inis, bsas
10711075

10721076
def listSource(self):
10731077
"""Return package structure as text."""
@@ -2309,17 +2313,25 @@ def _install(self, packages, refresh_ui, progress=None, last=False,
23092313
def __installer_install(self, installer, destFiles, index, progress,
23102314
refresh_ui):
23112315
sub_progress = SubProgress(progress, index, index + 1)
2312-
data_sizeCrcDate_update, mods, inis = installer.install(destFiles,
2313-
sub_progress)
2316+
data_sizeCrcDate_update, mods, inis, bsas = installer.install(
2317+
destFiles, sub_progress)
23142318
refresh_ui[0] |= bool(mods)
23152319
refresh_ui[1] |= bool(inis)
23162320
# refresh modInfos, iniInfos adding new/modified mods
2317-
from . import modInfos, iniInfos
2318-
for mod in set(mods):
2321+
from . import bsaInfos, modInfos, iniInfos
2322+
for mod in mods:
23192323
try:
23202324
modInfos.new_info(mod, owner=installer.archive)
23212325
except FileError:
23222326
mods.discard(mod)
2327+
# Notify the bsaInfos cache of any new BSAs, since we may have
2328+
# installed a localized plugin and the LO syncs below will check for
2329+
# missing strings ##: Identical to mods loop above!
2330+
for bsa in bsas:
2331+
try:
2332+
bsaInfos.new_info(bsa, owner=installer.archive)
2333+
except FileError:
2334+
bsas.discard(bsa)
23232335
modInfos.cached_lo_append_if_missing(mods)
23242336
modInfos.refreshLoadOrder(unlock_lo=True)
23252337
# now that we saved load order update missing mtimes for mods:

0 commit comments

Comments
 (0)