fix(steam): keep a cleared FEX default for a listed title as a native choice

A listed title whose automatic FEX mapping the player clears now records
the empty mapping as a native choice, as titles with NATIVE_CHOICE do,
instead of getting FEX again on the next run.
This commit is contained in:
phj1081 authored and Kurt Himebauch committed 2026-11-05 14:22:15 -05:00
1 parent 28d4f58f33
commit 7e0859872b
2 files changed
+41 -1

No files matched your search

+40
View File
@@ -1682,6 +1682,46 @@ class ProtonDefaultTest(unittest.TestCase):
self.assertEqual(changes, {})
self.assertEqual(auto, {})
def test_a_cleared_fex_default_for_a_listed_title_is_kept_as_a_native_choice(self):
app = "4385780"
fex = COMPAT["FEX_TOOL"]
with tempfile.TemporaryDirectory() as tmp:
steam = Path(tmp) / "Steam"
config = steam / "config/config.vdf"
config.parent.mkdir(parents=True)
config.write_text(config_text([("0", self.TOOL)]))
(Path(tmp) / "state.json").write_text(json.dumps({"default": self.TOOL, "auto": {}}))
globals_ = COMPAT["native_targets"].__globals__
original_platforms = globals_["appinfo_platforms"]
globals_["appinfo_platforms"] = lambda _path, wanted: {
app: ({"linux", "windows"}, "64", "game")
} if app in wanted else {}
try:
def run():
COMPAT["register_default"](str(config), [app], catalog=self.CATALOG, directory=tmp)
return json.loads((Path(tmp) / "state.json").read_text())
state = run()
self.assertEqual(mapping_of(config.read_text()), {"0": self.TOOL, app: fex})
self.assertEqual(state["auto"], {app: fex})
config.write_text(config_text([("0", self.TOOL), (app, "")]))
state = run()
cleared = config.read_bytes()
self.assertEqual(mapping_of(cleared.decode()), {"0": self.TOOL, app: ""})
self.assertEqual(state["auto"], {})
self.assertEqual(state["native_choices"], [app])
run()
self.assertEqual(config.read_bytes(), cleared)
config.write_text(config_text([("0", self.TOOL), (app, fex)]))
state = run()
self.assertEqual(mapping_of(config.read_text()), {"0": self.TOOL, app: fex})
self.assertEqual(state["native_choices"], [])
finally:
globals_["appinfo_platforms"] = original_platforms
def test_factorio_preserves_an_observed_native_choice_despite_ambiguous_metadata(self):
with tempfile.TemporaryDirectory() as tmp:
steam = Path(tmp) / "Steam"