mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
feat: reach the network share from a Mac or Linux
This commit is contained in:
1 parent
6fb79cab6d
commit
b62ebf384b
2 files changed
+43
-1
No files matched your search
@@ -4078,6 +4078,33 @@ def _network_share(name: str, guide: Guide) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def _share_tabs(name: str, share: str) -> tuple[dict[str, str], dict[str, str]]:
|
||||
"""The command per computer for a network folder (\\\\RECALBOX\\share\\bios),
|
||||
and how a Mac or a Linux desktop opens that folder first. Only Windows
|
||||
had a line: a Mac user fell back to SSH or to taking the card out.
|
||||
|
||||
macOS mounts smb://recalbox/share at /Volumes/share. A Linux desktop
|
||||
mounts it where its file manager chooses, so that tab names the folder.
|
||||
"""
|
||||
host, _, rest = share.lstrip("\\").partition("\\")
|
||||
volume, _, below = rest.partition("\\")
|
||||
url = f"smb://{host.lower()}/{volume}"
|
||||
tail = "/" + below.replace("\\", "/") if below else ""
|
||||
args = {
|
||||
"windows": f"--platform {name} --dest {share}",
|
||||
"macos": f"--platform {name} --dest /Volumes/{volume}{tail}",
|
||||
"linux": f"--platform {name} --dest /path/to/{volume}{tail}",
|
||||
}
|
||||
how = {
|
||||
"macos": (f"In Finder, choose Go, then Connect to Server, and enter `{url}`. "
|
||||
f"It opens as `/Volumes/{volume}`. Then open **Terminal**, in "
|
||||
"Applications, then Utilities. Paste the line. Press Return."),
|
||||
"linux": (f"Open `{url}` in your file manager. Open a terminal, paste the line "
|
||||
f"and change `/path/to/{volume}` to the folder it opened. Press Enter."),
|
||||
}
|
||||
return args, how
|
||||
|
||||
|
||||
def _offline_line(name: str) -> list[str]:
|
||||
"""The offline line, on a setup whose ZIP a release publishes: the
|
||||
installer reads that ZIP with no network (`--from-pack`)."""
|
||||
@@ -4138,10 +4165,11 @@ def _setup_routes(name: str, display: str, page_link: bool = False) -> list[str]
|
||||
if share or (card and guide.run == ("device",)):
|
||||
computer = ["## From your computer { #from-your-computer }", ""]
|
||||
if share:
|
||||
args, how = _share_tabs(name, share)
|
||||
computer += [
|
||||
"Needs the device on your network. Run the command on the computer.",
|
||||
"",
|
||||
*terminal_tabs(("windows",), {"windows": f"--platform {name} --dest {share}"}),
|
||||
*terminal_tabs(("windows", "macos", "linux"), args, how=how),
|
||||
SAFE_LINK,
|
||||
"",
|
||||
]
|
||||
|
||||
@@ -85,6 +85,20 @@ class NoZipNoUnzipText(unittest.TestCase):
|
||||
self.assertIn("Needs the device on your network.", text)
|
||||
self.assertIn(f"--platform {name} --dest {share}\n", text)
|
||||
|
||||
def test_a_mac_and_a_linux_desktop_reach_the_share_too(self):
|
||||
"""The share route was a PowerShell tab alone: a Mac user with Recalbox
|
||||
on Wi-Fi fell back to SSH or to taking the card out."""
|
||||
args, how = generate_site._share_tabs("recalbox", "\\\\RECALBOX\\share\\bios")
|
||||
self.assertEqual(args["macos"], "--platform recalbox --dest /Volumes/share/bios")
|
||||
self.assertIn("`smb://recalbox/share`", how["macos"])
|
||||
self.assertIn("`/Volumes/share`", how["macos"])
|
||||
self.assertEqual(args["linux"], "--platform recalbox --dest /path/to/share/bios")
|
||||
self.assertIn("`smb://recalbox/share`", how["linux"])
|
||||
lines = generate_site._setup_routes("recalbox", "Recalbox")
|
||||
routes = "\n".join(lines[:lines.index("## On the device { #install }")])
|
||||
for label in ("Windows", "macOS", "Linux"):
|
||||
self.assertIn(f'label="{label}"', routes)
|
||||
|
||||
def test_the_network_route_needs_a_share_and_no_zip(self):
|
||||
for name in SETUPS:
|
||||
share = generate_site._network_share(name, siteguides.GUIDES[name])
|
||||
|
||||
Reference in new issue
Block a user