Make Heroic and itch sources available on macOS
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import os
|
||||
import shlex
|
||||
from pathlib import Path
|
||||
from sys import platform
|
||||
from time import time
|
||||
from typing import Any, Optional
|
||||
|
||||
@@ -106,7 +106,7 @@ class DetailsDialog(Adw.Dialog):
|
||||
# As in software
|
||||
exe_name = _("program")
|
||||
|
||||
if os.name == "nt":
|
||||
if platform == "win32":
|
||||
exe_name += ".exe"
|
||||
# Translate this string as you would translate "path to {}"
|
||||
exe_path = _("C:\\path\\to\\{}").format(exe_name)
|
||||
@@ -118,7 +118,7 @@ class DetailsDialog(Adw.Dialog):
|
||||
exe_path = _("/path/to/{}").format(exe_name)
|
||||
# Translate this string as you would translate "path to {}"
|
||||
file_path = _("/path/to/{}").format(file_name)
|
||||
command = "xdg-open"
|
||||
command = "open" if platform == "darwin" else "xdg-open"
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
exec_info_text = _(
|
||||
|
||||
@@ -355,7 +355,7 @@ class HeroicSource(URLExecutableSource):
|
||||
name = _("Heroic")
|
||||
iterable_class = HeroicSourceIterable
|
||||
url_format = "heroic://launch/{runner}/{app_name}"
|
||||
available_on = {"linux", "win32"}
|
||||
available_on = {"linux", "win32", "darwin"}
|
||||
|
||||
locations: HeroicLocations
|
||||
|
||||
@@ -377,6 +377,7 @@ class HeroicSource(URLExecutableSource):
|
||||
/ "config"
|
||||
/ "heroic",
|
||||
shared.appdata_dir / "heroic",
|
||||
shared.app_support_dir / "heroic",
|
||||
),
|
||||
paths={
|
||||
"config.json": LocationSubPath("config.json"),
|
||||
|
||||
@@ -81,7 +81,7 @@ class ItchSource(URLExecutableSource):
|
||||
name = _("itch")
|
||||
iterable_class = ItchSourceIterable
|
||||
url_format = "itch://caves/{cave_id}/launch"
|
||||
available_on = {"linux", "win32"}
|
||||
available_on = {"linux", "win32", "darwin"}
|
||||
|
||||
locations: ItchLocations
|
||||
|
||||
@@ -95,6 +95,7 @@ class ItchSource(URLExecutableSource):
|
||||
shared.config_dir / "itch",
|
||||
shared.host_config_dir / "itch",
|
||||
shared.appdata_dir / "itch",
|
||||
shared.app_support_dir / "itch",
|
||||
),
|
||||
paths={
|
||||
"butler.db": LocationSubPath("db/butler.db"),
|
||||
|
||||
@@ -30,6 +30,7 @@ from cartridges import shared
|
||||
from cartridges.errors.friendly_error import FriendlyError
|
||||
from cartridges.game import Game
|
||||
from cartridges.importer.bottles_source import BottlesSource
|
||||
from cartridges.importer.desktop_source import DesktopSource
|
||||
from cartridges.importer.flatpak_source import FlatpakSource
|
||||
from cartridges.importer.heroic_source import HeroicSource
|
||||
from cartridges.importer.itch_source import ItchSource
|
||||
@@ -169,6 +170,10 @@ class CartridgesPreferences(Adw.PreferencesDialog):
|
||||
else:
|
||||
self.init_source_row(source)
|
||||
|
||||
# Special case for the desktop source
|
||||
if not DesktopSource().is_available:
|
||||
self.desktop_switch.set_visible(False)
|
||||
|
||||
# SteamGridDB
|
||||
def sgdb_key_changed(*_args: Any) -> None:
|
||||
shared.schema.set_string("sgdb-key", self.sgdb_key_entry_row.get_text())
|
||||
|
||||
Reference in New Issue
Block a user