mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: join system names with a separator they lack
This commit is contained in:
1 parent
e644463c17
commit
9c154a29b9
2 files changed
+19
-2
No files matched your search
@@ -258,9 +258,12 @@ def _bounded_join(parts: list[str], keys: list[str]) -> str:
|
||||
"""Parts joined while they fit, else the first, a count and a digest.
|
||||
|
||||
Thirty systems joined made a 261-byte file name and the ZIP could not
|
||||
be opened; the digest keeps two different selections apart.
|
||||
be opened; the digest keeps two different selections apart. The joiner
|
||||
is one no part holds: with "_", sega-dreamcast + arcade and
|
||||
sega-dreamcast-arcade both named Dreamcast_Arcade, and the second build
|
||||
replaced the first.
|
||||
"""
|
||||
joined = "_".join(parts)
|
||||
joined = "+".join(parts)
|
||||
if len(joined.encode("utf-8")) <= MAX_SYSTEM_TAG_BYTES:
|
||||
return joined
|
||||
digest = hashlib.sha1("\n".join(sorted(keys)).encode("utf-8")).hexdigest()[:8]
|
||||
|
||||
@@ -2637,6 +2637,20 @@ class APackNameFitsAFileName(unittest.TestCase):
|
||||
self.assertNotEqual(tag, _system_tag(systems[:-1] + ["other-console"]))
|
||||
self.assertEqual(_system_tag(["sony-playstation"]), "_Playstation")
|
||||
|
||||
def test_two_systems_never_name_one_system(self):
|
||||
"""sega-dreamcast,arcade and sega-dreamcast-arcade both wrote
|
||||
RetroArch_..._Dreamcast_Arcade.zip; the second replaced the first."""
|
||||
from scripts.generate_pack import _system_tag
|
||||
|
||||
pairs = [
|
||||
(["sega-dreamcast", "arcade"], ["sega-dreamcast-arcade"]),
|
||||
(["mega-cd", "sega-32x"], ["mega-cd-32x"]),
|
||||
(["x86", "nintendo-64"], ["x86-64"]),
|
||||
]
|
||||
for two, one in pairs:
|
||||
with self.subTest(two=two):
|
||||
self.assertNotEqual(_system_tag(two), _system_tag(one))
|
||||
|
||||
def test_two_hash_lists_get_two_names(self):
|
||||
"""--from-md5 named its pack after the context only: a second list
|
||||
overwrote the first pack in the same directory."""
|
||||
|
||||
Reference in new issue
Block a user