Skip to content

Commit

Permalink
better handling of init and overrides for twbt_ folders
Browse files Browse the repository at this point in the history
  • Loading branch information
thurin committed Jul 12, 2021
1 parent 535ecc8 commit 6b2ba77
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions core/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,23 @@ def install_graphics(pack):
except:
pass
try:
shutil.copyfile(
paths.get('graphics', pack, 'data', 'init', 'overrides.txt'),
paths.get('init', 'overrides.txt'))
if ('twbt' in lnp.df_info.variations) & lnp.userconfig.get_value('insttwbt', True) & os.path.isfile(paths.get('graphics', pack, 'data', 'twbt_init', 'overrides.txt')):
shutil.copyfile(
paths.get('graphics', pack, 'data', 'twbt_init', 'overrides.txt'),
paths.get('init', 'overrides.txt'))
else:
shutil.copyfile(
paths.get('graphics', pack, 'data', 'init', 'overrides.txt'),
paths.get('init', 'overrides.txt'))

except:
pass

# TwbT file replacements
if ('twbt' in lnp.df_info.variations) & lnp.userconfig.get_value('insttwbt', True):
log.i("Need to Copy TWBT")

for folder in ['art', 'init']:
for folder in ['art']:
twbt_folder = paths.get('graphics', pack, 'data', 'twbt_' + folder)
target_folder = paths.get('df', 'data', folder)
for path, _, files in os.walk(twbt_folder):
Expand Down Expand Up @@ -276,7 +282,11 @@ def patch_inits(gfx_dir):
init_fields = [f for f in init_fields if lnp.settings.version_has_option(f)]
d_init_fields = [
f for f in d_init_fields if lnp.settings.version_has_option(f)]
init = os.path.join(gfx_dir, 'data', 'init', 'init.txt')
if ('twbt' in lnp.df_info.variations) & lnp.userconfig.get_value('insttwbt', True) & os.path.isfile( os.path.join(gfx_dir, 'data', 'twbt_init', 'init.txt')):
init = os.path.join(gfx_dir, 'data', 'twbt_init', 'init.txt')
else:
init = os.path.join(gfx_dir, 'data', 'init', 'init.txt')

if lnp.df_info.version <= '0.31.03':
d_init = init
else:
Expand Down

0 comments on commit 6b2ba77

Please sign in to comment.