Client: macOS support

This commit is contained in:
sarah committed 2026-10-14 13:18:19 +02:00
1 parent 5c04a4a77d
commit d86e33fd4a
4 files changed
+80 -9

No files matched your search

+13 -1
View File
@@ -31,7 +31,7 @@ from typing import Optional
import httpx
from Core import AssetsDir, ChildEnvironment, DataHome, AppName, IsWindows
from Core import AssetsDir, ChildEnvironment, DataHome, AppName, Home, IsMac, IsWindows
ToolsDir = DataHome / AppName / "DiagramTools"
PythonDir = ToolsDir / "Python"
@@ -53,6 +53,12 @@ WindowsBrowsers = [
r"Google\Chrome\Application\chrome.exe",
r"BraveSoftware\Brave-Browser\Application\brave.exe",
]
MacBrowsers = [ # in /Applications or ~/Applications
"Google Chrome.app/Contents/MacOS/Google Chrome",
"Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
"Brave Browser.app/Contents/MacOS/Brave Browser",
"Chromium.app/Contents/MacOS/Chromium",
]
class DiagramError(Exception):
@@ -169,6 +175,12 @@ def _InstalledBrowser() -> Optional[str]:
if Base and (Path(Base) / Relative).is_file():
return str(Path(Base) / Relative)
return None
if IsMac:
for Base in (Path("/Applications"), Home / "Applications"):
for Relative in MacBrowsers:
if (Base / Relative).is_file():
return str(Base / Relative)
return None
return next((Found for Name in BrowserNames if (Found := shutil.which(Name))), None)