fix(library): keep another program of a Steam install out of the Steam app's route (#2742)

* fix(library): keep another program of a Steam install out of the Steam app's route

* fix(library): cover a Steam-edited target in the unrouted-program test and docs

* fix(library): keep Steam-edited targets routed and release stale Spacewar imports for other programs

* fix(library): keep Steam-edited targets adopted before the marker existed routed

A saved executable and seen revision without the adoption marker are recognised
from the Steam shortcut record (its target is the current executable and differs
from the one the app asked for), and the marker is stored.
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-24 17:50:09 -05:00
1 parent 43ff1db06b
commit 46d42f9ca9
7 files changed
+170 -10

No files matched your search

+36
View File
@@ -261,6 +261,27 @@ class ImportsTest(unittest.TestCase):
imports.watch(str(self.steam), str(listing))
identify.assert_not_called()
def test_another_program_of_a_steam_install_stays_a_shortcut_beside_the_steam_app(self):
game, library = self.steam_install()
other = dict(game, name='Mod Launcher', exe=str(Path(game['folder']) / 'ModLauncher.exe'),
appid=0x87654322, route=False)
Path(other['exe']).write_bytes(b'mod')
imports.save_json(self.acct / 'config' / imports.STATE,
dict(account='123', owned={'42': True}, candidates={game['folder']: 42},
sources={game['folder']: imports.source_stamp(game)}))
games, routes = imports.route(self.steam, self.acct, [game, other])
self.assertEqual([other], games)
self.assertEqual({str(game['appid']): 42}, routes)
link = self.steam / 'steamapps/compatdata' / str(other['appid'] & 0xFFFFFFFF)
self.assertEqual(library / 'steamapps/compatdata/42', link.resolve())
def test_watch_never_looks_up_programs_that_are_not_the_steam_apps_own(self):
listing = self.root / 'games.json'
listing.write_text(json.dumps([dict(self.game, route=False)]))
with patch.object(imports, 'identify') as identify:
imports.watch(str(self.steam), str(listing))
identify.assert_not_called()
def test_native_programs_stay_shortcuts_and_are_never_looked_up(self):
self.snapshot()
game = dict(self.game, native=True)
@@ -692,6 +713,21 @@ class ImportsTest(unittest.TestCase):
self.assert_not_imported_as(480)
self.assertEqual(b'game', self.exe.read_bytes())
def test_spacewar_import_is_released_for_a_program_that_is_not_the_steam_apps_own(self):
self.import_as(480)
other = dict(self.game, appid=0x87654322, route=False)
with patch('builtins.print'):
self.assertEqual(([other], {}), imports.route(self.steam, self.acct, [other]))
self.assert_not_imported_as(480)
self.assertEqual(b'game', self.exe.read_bytes())
def test_a_steam_import_stays_when_another_program_of_the_install_is_listed(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])
other = dict(self.game, appid=0x87654322, route=False)
imports.route(self.steam, self.acct, [other])
self.assertTrue((self.steam / 'steamapps/appmanifest_42.acf').is_file())
def test_import_follows_the_app_the_files_name_now(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])