Skip to content

Commit f13ded3

Browse files
InfernioSharlikran
authored andcommitted
Refactor some logic in init_dirs
Eliminates the one remaining warning in there and simplifies the logic a bit. I'm pretty sure this also fixes a potential issue where dirs['mods'] is unassigned when an INI exists in the game folder, but bUseMyGamesDirectory is set to 1.
1 parent 8825c77 commit f13ded3

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

Mopy/bash/initialization.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,19 @@ def init_dirs(bashIni_, personal, localAppData, game_info):
151151
# actually matter.
152152
# Utumno: not sure how/if this applies to other games
153153
data_oblivion_ini = dirs['app'].join(game_info.iniFiles[0])
154-
use_data_dir = False
154+
game_ini_path = dirs['saveBase'].join(game_info.iniFiles[0])
155+
dirs['mods'] = dirs['app'].join(u'Data')
155156
if data_oblivion_ini.exists():
156157
oblivionIni = ConfigParser()
157158
oblivionIni.read(data_oblivion_ini.s)
158159
# is bUseMyGamesDirectory set to 0?
159-
use_data_dir = get_ini_option(oblivionIni,
160-
u'bUseMyGamesDirectory') == u'0'
161-
if use_data_dir:
162-
game_ini_path = data_oblivion_ini
163-
# Set the save game folder to the Oblivion directory
164-
dirs['saveBase'] = dirs['app']
165-
# Set the data folder to sLocalMasterPath
166-
dirs['mods'] = dirs['app'].join(get_ini_option(oblivionIni,
167-
u'SLocalMasterPath') or u'Data')
168-
else:
169-
game_ini_path = dirs['saveBase'].join(game_info.iniFiles[0])
170-
dirs['mods'] = dirs['app'].join(u'Data')
160+
if get_ini_option(oblivionIni, u'bUseMyGamesDirectory') == u'0':
161+
game_ini_path = data_oblivion_ini
162+
# Set the save game folder to the Oblivion directory
163+
dirs['saveBase'] = dirs['app']
164+
# Set the data folder to sLocalMasterPath
165+
dirs['mods'] = dirs['app'].join(get_ini_option(oblivionIni,
166+
u'SLocalMasterPath') or u'Data')
171167
# these are relative to the mods path so they must be set here
172168
dirs['patches'] = dirs['mods'].join(u'Bash Patches')
173169
dirs['tweaks'] = dirs['mods'].join(u'INI Tweaks')

0 commit comments

Comments
 (0)