diff --git a/installer/steps.py b/installer/steps.py index 81a46cd2..54130b98 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -768,9 +768,12 @@ class Lift(Step): transient = True def key(self, ctx): + # fingerprint takes a file's name and content only; the paths under mods/ go in too, because tools/cheats.py + # and tools/exefs_patches.py name each patch set after its mod folder, so a renamed folder needs a lift + files = cheat_files(ctx) + exefs_files(ctx) return fingerprint('lift-4', ctx.keys['extract'], ctx.layout.recomp, ctx.layout.patches(game_version(ctx)), - ctx.layout.tools / 'cheats.py', ctx.layout.tools / 'exefs_patches.py', *cheat_files(ctx), - *exefs_files(ctx)) + ctx.layout.tools / 'cheats.py', ctx.layout.tools / 'exefs_patches.py', *files, + *(f.relative_to(ctx.dest / 'mods').as_posix() for f in files)) def current(self, ctx, record): gen = ctx.temp / 'gen' diff --git a/tests/installer_test.py b/tests/installer_test.py index 66cc31c6..e34c55d0 100644 --- a/tests/installer_test.py +++ b/tests/installer_test.py @@ -254,6 +254,19 @@ class LiftKeyTest(unittest.TestCase): self.add_cheats('main.npdm', 'not a patch', mod='Fps', where='exefs') self.assertEqual(self.key(), both) + def test_renaming_a_mod_folder_changes_the_key(self): + # tools/cheats.py and tools/exefs_patches.py name a patch set after "/": a renamed + # folder needs a lift even though its files are the same + self.add_cheats('277178B7DBA1B6D4.txt', '[a]', mod='MyNXCheats') + self.add_cheats('dynamic-fps.pchtxt', '@nsobid-277178B7DBA1B6D4', mod='Fps', where='exefs') + before = self.key() + mods = self.dest / 'mods' + (mods / 'MyNXCheats').rename(mods / 'MyNXCheats 1.4.3') + cheats_renamed = self.key() + self.assertNotEqual(cheats_renamed, before) + (mods / 'Fps').rename(mods / 'Fps 2') + self.assertNotEqual(self.key(), cheats_renamed) + def test_status_and_other_files_keep_the_key(self): self.add_cheats('277178B7DBA1B6D4.txt', '[a]') before = self.key()