Use new functions in preferences
This commit is contained in:
@@ -25,26 +25,32 @@ import yaml
|
|||||||
from .check_install import check_install
|
from .check_install import check_install
|
||||||
|
|
||||||
|
|
||||||
def bottles_importer(win):
|
def bottles_installed(win, path=None):
|
||||||
schema = win.schema
|
|
||||||
location_key = "bottles-location"
|
location_key = "bottles-location"
|
||||||
bottles_dir = Path(schema.get_string(location_key)).expanduser()
|
bottles_dir = (
|
||||||
|
path if path else Path(win.schema.get_string(location_key)).expanduser()
|
||||||
|
)
|
||||||
check = "library.yml"
|
check = "library.yml"
|
||||||
|
|
||||||
if not (bottles_dir / check).is_file():
|
if not (bottles_dir / check).is_file():
|
||||||
locations = (
|
locations = (
|
||||||
Path.home()
|
(Path(),)
|
||||||
/ ".var"
|
if path
|
||||||
/ "app"
|
else (
|
||||||
/ "com.usebottles.bottles"
|
Path.home() / ".var/app/com.usebottles.bottles/data/bottles",
|
||||||
/ "data"
|
win.data_dir / "bottles",
|
||||||
/ "bottles",
|
)
|
||||||
win.data_dir / "bottles",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bottles_dir = check_install(check, locations, (schema, location_key))
|
bottles_dir = check_install(check, locations, (win.schema, location_key))
|
||||||
if not bottles_dir:
|
|
||||||
return
|
return bottles_dir
|
||||||
|
|
||||||
|
|
||||||
|
def bottles_importer(win):
|
||||||
|
bottles_dir = bottles_installed(win)
|
||||||
|
if not bottles_dir:
|
||||||
|
return
|
||||||
|
|
||||||
current_time = int(time())
|
current_time = int(time())
|
||||||
|
|
||||||
|
|||||||
@@ -26,39 +26,41 @@ from time import time
|
|||||||
from .check_install import check_install
|
from .check_install import check_install
|
||||||
|
|
||||||
|
|
||||||
def heroic_importer(win):
|
def heroic_installed(win, path=None):
|
||||||
schema = win.schema
|
|
||||||
location_key = "heroic-location"
|
location_key = "heroic-location"
|
||||||
heroic_dir = Path(schema.get_string(location_key)).expanduser()
|
heroic_dir = (
|
||||||
|
path if path else Path(win.schema.get_string(location_key)).expanduser()
|
||||||
|
)
|
||||||
check = "config.json"
|
check = "config.json"
|
||||||
|
|
||||||
if not (heroic_dir / check).is_file():
|
if not (heroic_dir / check).is_file():
|
||||||
locations = (
|
locations = (
|
||||||
Path.home()
|
(Path(),)
|
||||||
/ ".var"
|
if path
|
||||||
/ "app"
|
else (
|
||||||
/ "com.heroicgameslauncher.hgl"
|
Path.home() / ".var/app/com.heroicgameslauncher.hgl/config/heroic",
|
||||||
/ "config"
|
win.config_dir / "heroic",
|
||||||
/ "heroic",
|
)
|
||||||
win.config_dir / "heroic",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt" and not path:
|
||||||
locations += (Path(os.getenv("appdata")) / "heroic",)
|
locations += (Path(os.getenv("appdata")) / "heroic",)
|
||||||
|
|
||||||
heroic_dir = check_install(check, locations, (schema, location_key))
|
heroic_dir = check_install(check, locations, (win.schema, location_key))
|
||||||
if not heroic_dir:
|
|
||||||
return
|
|
||||||
|
|
||||||
schema = win.schema
|
return heroic_dir
|
||||||
check = "config.json"
|
|
||||||
|
|
||||||
|
def heroic_importer(win):
|
||||||
|
heroic_dir = heroic_installed(win)
|
||||||
|
if not heroic_dir:
|
||||||
|
return
|
||||||
|
|
||||||
current_time = int(time())
|
current_time = int(time())
|
||||||
|
|
||||||
importer = win.importer
|
importer = win.importer
|
||||||
|
|
||||||
# Import Epic games
|
# Import Epic games
|
||||||
if not schema.get_boolean("heroic-import-epic"):
|
if not win.schema.get_boolean("heroic-import-epic"):
|
||||||
pass
|
pass
|
||||||
elif (heroic_dir / "store_cache" / "legendary_library.json").exists():
|
elif (heroic_dir / "store_cache" / "legendary_library.json").exists():
|
||||||
data = (heroic_dir / "store_cache" / "legendary_library.json").read_text(
|
data = (heroic_dir / "store_cache" / "legendary_library.json").read_text(
|
||||||
@@ -112,7 +114,7 @@ def heroic_importer(win):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Import GOG games
|
# Import GOG games
|
||||||
if not schema.get_boolean("heroic-import-gog"):
|
if not win.schema.get_boolean("heroic-import-gog"):
|
||||||
pass
|
pass
|
||||||
elif (heroic_dir / "gog_store" / "installed.json").exists():
|
elif (heroic_dir / "gog_store" / "installed.json").exists():
|
||||||
data = (heroic_dir / "gog_store" / "installed.json").read_text("utf-8")
|
data = (heroic_dir / "gog_store" / "installed.json").read_text("utf-8")
|
||||||
@@ -160,7 +162,7 @@ def heroic_importer(win):
|
|||||||
importer.save_game(values, image_path if image_path.exists() else None)
|
importer.save_game(values, image_path if image_path.exists() else None)
|
||||||
|
|
||||||
# Import sideloaded games
|
# Import sideloaded games
|
||||||
if not schema.get_boolean("heroic-import-sideload"):
|
if not win.schema.get_boolean("heroic-import-sideload"):
|
||||||
pass
|
pass
|
||||||
elif (heroic_dir / "sideload_apps" / "library.json").exists():
|
elif (heroic_dir / "sideload_apps" / "library.json").exists():
|
||||||
data = (heroic_dir / "sideload_apps" / "library.json").read_text("utf-8")
|
data = (heroic_dir / "sideload_apps" / "library.json").read_text("utf-8")
|
||||||
|
|||||||
@@ -113,25 +113,35 @@ def get_games_async(win, rows, importer):
|
|||||||
task.run_in_thread(create_func(current_time, win, row))
|
task.run_in_thread(create_func(current_time, win, row))
|
||||||
|
|
||||||
|
|
||||||
def itch_importer(win):
|
def itch_installed(win, path=None):
|
||||||
schema = win.schema
|
|
||||||
location_key = "itch-location"
|
location_key = "itch-location"
|
||||||
itch_dir = Path(schema.get_string(location_key)).expanduser()
|
itch_dir = path if path else Path(win.schema.get_string(location_key)).expanduser()
|
||||||
check = Path("db") / "butler.db"
|
check = Path("db") / "butler.db"
|
||||||
|
|
||||||
if not (itch_dir / check).is_file():
|
if not (itch_dir / check).is_file():
|
||||||
locations = (
|
locations = (
|
||||||
Path.home() / ".var" / "app" / "io.itch.itch" / "config" / "itch",
|
(Path(),)
|
||||||
win.config_dir / "itch",
|
if path
|
||||||
|
else (
|
||||||
|
Path.home() / ".var/app/io.itch.itch/config/itch",
|
||||||
|
win.config_dir / "itch",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt" and not path:
|
||||||
locations += (Path(os.getenv("appdata")) / "itch",)
|
locations += (Path(os.getenv("appdata")) / "itch",)
|
||||||
|
|
||||||
if not check_install(check, locations, (schema, location_key)):
|
itch_dir = check_install(check, locations, (win.schema, location_key))
|
||||||
return
|
|
||||||
|
|
||||||
database_path = (Path(schema.get_string(location_key)) / "db").expanduser()
|
return itch_dir
|
||||||
|
|
||||||
|
|
||||||
|
def itch_importer(win):
|
||||||
|
itch_dir = itch_installed(win)
|
||||||
|
if not itch_dir:
|
||||||
|
return
|
||||||
|
|
||||||
|
database_path = (itch_dir / "db").expanduser()
|
||||||
|
|
||||||
db_cache_dir = win.cache_dir / "cartridges" / "itch"
|
db_cache_dir = win.cache_dir / "cartridges" / "itch"
|
||||||
db_cache_dir.mkdir(parents=True, exist_ok=True)
|
db_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
@@ -25,38 +25,56 @@ from time import time
|
|||||||
from .check_install import check_install
|
from .check_install import check_install
|
||||||
|
|
||||||
|
|
||||||
def lutris_importer(win):
|
def lutris_installed(win, path=None):
|
||||||
schema = win.schema
|
|
||||||
location_key = "lutris-location"
|
location_key = "lutris-location"
|
||||||
lutris_dir = Path(schema.get_string(location_key)).expanduser()
|
lutris_dir = (
|
||||||
|
path if path else Path(win.schema.get_string(location_key)).expanduser()
|
||||||
|
)
|
||||||
check = "pga.db"
|
check = "pga.db"
|
||||||
|
|
||||||
if not (lutris_dir / check).is_file():
|
if not (lutris_dir / check).is_file():
|
||||||
locations = (
|
locations = (
|
||||||
Path.home() / ".var" / "app" / "net.lutris.Lutris" / "data" / "lutris",
|
(Path(),)
|
||||||
win.data_dir / "lutris",
|
if path
|
||||||
|
else (
|
||||||
|
Path.home() / ".var/app/net.lutris.Lutris/data/lutris",
|
||||||
|
win.data_dir / "lutris",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
lutris_dir = check_install(check, locations, (schema, location_key))
|
lutris_dir = check_install(check, locations, (win.schema, location_key))
|
||||||
if not lutris_dir:
|
|
||||||
return
|
|
||||||
|
|
||||||
|
return lutris_dir
|
||||||
|
|
||||||
|
|
||||||
|
def lutris_cache_exists(win, path=None):
|
||||||
cache_key = "lutris-cache-location"
|
cache_key = "lutris-cache-location"
|
||||||
cache_dir = Path(schema.get_string(cache_key)).expanduser()
|
cache_dir = path if path else Path(win.schema.get_string(cache_key)).expanduser()
|
||||||
cache_check = "coverart"
|
cache_check = "coverart"
|
||||||
|
|
||||||
if not (cache_dir / cache_check).exists():
|
if not (cache_dir / cache_check).exists():
|
||||||
cache_locations = (
|
cache_locations = (
|
||||||
Path.home() / ".var" / "app" / "net.lutris.Lutris" / "cache" / "lutris",
|
(Path(),)
|
||||||
win.cache_dir / "lutris",
|
if path
|
||||||
|
else (
|
||||||
|
Path.home() / ".var" / "app" / "net.lutris.Lutris" / "cache" / "lutris",
|
||||||
|
win.cache_dir / "lutris",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
cache_dir = check_install(check, cache_locations, (schema, location_key))
|
cache_dir = check_install(cache_check, cache_locations, (win.schema, cache_key))
|
||||||
if not cache_dir:
|
|
||||||
return
|
|
||||||
|
|
||||||
database_path = (Path(schema.get_string(location_key))).expanduser()
|
return cache_dir
|
||||||
cache_dir = Path(schema.get_string(cache_key)).expanduser()
|
|
||||||
|
|
||||||
|
def lutris_importer(win):
|
||||||
|
lutris_dir = lutris_installed(win)
|
||||||
|
if not lutris_dir:
|
||||||
|
return
|
||||||
|
|
||||||
|
cache_dir = lutris_cache_exists(win)
|
||||||
|
if not cache_dir:
|
||||||
|
return
|
||||||
|
|
||||||
db_cache_dir = win.cache_dir / "cartridges" / "lutris"
|
db_cache_dir = win.cache_dir / "cartridges" / "lutris"
|
||||||
db_cache_dir.mkdir(parents=True, exist_ok=True)
|
db_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
@@ -64,7 +82,7 @@ def lutris_importer(win):
|
|||||||
# Copy the file because sqlite3 doesn't like databases in /run/user/
|
# Copy the file because sqlite3 doesn't like databases in /run/user/
|
||||||
database_tmp_path = db_cache_dir / "pga.db"
|
database_tmp_path = db_cache_dir / "pga.db"
|
||||||
|
|
||||||
for db_file in database_path.glob("pga.db*"):
|
for db_file in lutris_dir.glob("pga.db*"):
|
||||||
copyfile(db_file, (db_cache_dir / db_file.name))
|
copyfile(db_file, (db_cache_dir / db_file.name))
|
||||||
|
|
||||||
db_request = """
|
db_request = """
|
||||||
@@ -87,7 +105,7 @@ def lutris_importer(win):
|
|||||||
# No need to unlink temp files as they disappear when the connection is closed
|
# No need to unlink temp files as they disappear when the connection is closed
|
||||||
database_tmp_path.unlink(missing_ok=True)
|
database_tmp_path.unlink(missing_ok=True)
|
||||||
|
|
||||||
if not schema.get_boolean("lutris-import-steam"):
|
if not win.schema.get_boolean("lutris-import-steam"):
|
||||||
rows = [row for row in rows if not row[3] == "steam"]
|
rows = [row for row in rows if not row[3] == "steam"]
|
||||||
|
|
||||||
current_time = int(time())
|
current_time = int(time())
|
||||||
|
|||||||
@@ -122,31 +122,42 @@ def get_games_async(win, appmanifests, steam_dir, importer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def steam_importer(win):
|
def steam_installed(win, path=None):
|
||||||
schema = win.schema
|
|
||||||
location_key = "steam-location"
|
location_key = "steam-location"
|
||||||
steam_dir = Path(schema.get_string(location_key)).expanduser()
|
steam_dir = Path(win.schema.get_string(location_key)).expanduser()
|
||||||
check = "steamapps"
|
check = "steamapps"
|
||||||
|
|
||||||
if not (steam_dir / check).is_file():
|
if not (steam_dir / check).is_file():
|
||||||
subdirs = ("steam", "Steam")
|
subdirs = ("steam", "Steam")
|
||||||
|
|
||||||
locations = (
|
locations = (
|
||||||
Path.home() / ".steam",
|
(path,)
|
||||||
win.data_dir / "Steam",
|
if path
|
||||||
Path.home() / ".var" / "app" / "com.valvesoftware.Steam" / "data" / "Steam",
|
else (
|
||||||
|
steam_dir,
|
||||||
|
Path.home() / ".steam",
|
||||||
|
win.data_dir / "Steam",
|
||||||
|
Path.home() / ".var/app/com.valvesoftware.Steam/data/Steam",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
locations += (Path(os.getenv("programfiles(x86)")) / "Steam",)
|
locations += (Path(os.getenv("programfiles(x86)")) / "Steam",)
|
||||||
|
|
||||||
steam_dir = check_install(check, locations, (schema, location_key), subdirs)
|
steam_dir = check_install(check, locations, (win.schema, location_key), subdirs)
|
||||||
if not steam_dir:
|
|
||||||
return
|
return steam_dir
|
||||||
|
|
||||||
|
|
||||||
|
def steam_importer(win):
|
||||||
|
steam_dir = steam_installed(win)
|
||||||
|
if not steam_dir:
|
||||||
|
return
|
||||||
|
|
||||||
appmanifests = []
|
appmanifests = []
|
||||||
|
|
||||||
steam_dirs = [Path(directory) for directory in schema.get_strv("steam-extra-dirs")]
|
steam_dirs = [
|
||||||
|
Path(directory) for directory in win.schema.get_strv("steam-extra-dirs")
|
||||||
|
]
|
||||||
steam_dirs.append(steam_dir)
|
steam_dirs.append(steam_dir)
|
||||||
|
|
||||||
for directory in steam_dirs:
|
for directory in steam_dirs:
|
||||||
|
|||||||
@@ -19,63 +19,61 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import move, copyfile
|
from shutil import copyfile, move
|
||||||
|
|
||||||
from gi.repository import Adw, Gio, GLib, Gtk
|
from gi.repository import Adw, Gio, GLib, Gtk
|
||||||
|
|
||||||
|
from .bottles_importer import bottles_installed
|
||||||
from .create_dialog import create_dialog
|
from .create_dialog import create_dialog
|
||||||
from .get_games import get_games
|
from .get_games import get_games
|
||||||
|
from .heroic_importer import heroic_installed
|
||||||
|
from .itch_importer import itch_installed
|
||||||
|
from .lutris_importer import lutris_cache_exists, lutris_installed
|
||||||
from .save_game import save_game
|
from .save_game import save_game
|
||||||
|
from .steam_importer import steam_installed
|
||||||
|
|
||||||
|
|
||||||
class ImportPreferences:
|
class ImportPreferences:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
window,
|
win,
|
||||||
source_id,
|
source_id,
|
||||||
name,
|
name,
|
||||||
install_key,
|
check_func,
|
||||||
paths,
|
|
||||||
expander_row,
|
expander_row,
|
||||||
file_chooser_button,
|
file_chooser_button,
|
||||||
config=False,
|
config=False,
|
||||||
):
|
):
|
||||||
def set_dir(_source, result, _unused):
|
def set_dir(_source, result, _unused):
|
||||||
try:
|
try:
|
||||||
path = Path(window.file_chooser.select_folder_finish(result).get_path())
|
path = Path(win.file_chooser.select_folder_finish(result).get_path())
|
||||||
|
|
||||||
def response(widget, response):
|
|
||||||
if response == "choose_folder":
|
|
||||||
window.choose_folder(widget, set_dir)
|
|
||||||
|
|
||||||
if not any((path / current_path).exists() for current_path in paths):
|
|
||||||
create_dialog(
|
|
||||||
window.win,
|
|
||||||
_("Installation Not Found"),
|
|
||||||
# The variable is the name of the game launcher
|
|
||||||
_("Select the {} configuration directory.").format(name)
|
|
||||||
if config
|
|
||||||
# The variable is the name of the game launcher
|
|
||||||
else _("Select the {} data directory.").format(name),
|
|
||||||
"choose_folder",
|
|
||||||
_("Set Location"),
|
|
||||||
).connect("response", response)
|
|
||||||
else:
|
|
||||||
window.schema.set_string(
|
|
||||||
install_key,
|
|
||||||
str(path),
|
|
||||||
)
|
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
return
|
||||||
|
|
||||||
window.schema.bind(
|
def response(widget, response):
|
||||||
|
if response == "choose_folder":
|
||||||
|
win.choose_folder(widget, set_dir)
|
||||||
|
|
||||||
|
if not check_func(win, path):
|
||||||
|
create_dialog(
|
||||||
|
win,
|
||||||
|
_("Installation Not Found"),
|
||||||
|
# The variable is the name of the game launcher
|
||||||
|
_("Select the {} configuration directory.").format(name) if config
|
||||||
|
# The variable is the name of the game launcher
|
||||||
|
else _("Select the {} data directory.").format(name),
|
||||||
|
"choose_folder",
|
||||||
|
_("Set Location"),
|
||||||
|
).connect("response", response)
|
||||||
|
|
||||||
|
win.schema.bind(
|
||||||
source_id,
|
source_id,
|
||||||
expander_row,
|
expander_row,
|
||||||
"enable-expansion",
|
"enable-expansion",
|
||||||
Gio.SettingsBindFlags.DEFAULT,
|
Gio.SettingsBindFlags.DEFAULT,
|
||||||
)
|
)
|
||||||
|
|
||||||
file_chooser_button.connect("clicked", window.choose_folder, set_dir)
|
file_chooser_button.connect("clicked", win.choose_folder, set_dir)
|
||||||
|
|
||||||
|
|
||||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
||||||
@@ -170,12 +168,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self,
|
self,
|
||||||
"steam",
|
"steam",
|
||||||
"Steam",
|
"Steam",
|
||||||
"steam-location",
|
steam_installed,
|
||||||
[
|
|
||||||
"steamapps",
|
|
||||||
Path("steam") / "steamapps",
|
|
||||||
Path("Steam") / "steamapps",
|
|
||||||
],
|
|
||||||
self.steam_expander_row,
|
self.steam_expander_row,
|
||||||
self.steam_file_chooser_button,
|
self.steam_file_chooser_button,
|
||||||
)
|
)
|
||||||
@@ -192,7 +185,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
value.append(self.file_chooser.select_folder_finish(result).get_path())
|
value.append(self.file_chooser.select_folder_finish(result).get_path())
|
||||||
self.schema.set_strv("steam-extra-dirs", value)
|
self.schema.set_strv("steam-extra-dirs", value)
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
return
|
||||||
update_revealer()
|
update_revealer()
|
||||||
|
|
||||||
def clear_steam_dirs(*_unused):
|
def clear_steam_dirs(*_unused):
|
||||||
@@ -211,8 +204,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self,
|
self,
|
||||||
"lutris",
|
"lutris",
|
||||||
"Lutris",
|
"Lutris",
|
||||||
"lutris-location",
|
lutris_installed,
|
||||||
["pga.db"],
|
|
||||||
self.lutris_expander_row,
|
self.lutris_expander_row,
|
||||||
self.lutris_file_chooser_button,
|
self.lutris_file_chooser_button,
|
||||||
)
|
)
|
||||||
@@ -226,26 +218,21 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
def set_cache_dir(_source, result, _unused):
|
def set_cache_dir(_source, result, _unused):
|
||||||
try:
|
try:
|
||||||
path = Path(self.file_chooser.select_folder_finish(result).get_path())
|
path = Path(self.file_chooser.select_folder_finish(result).get_path())
|
||||||
|
|
||||||
def response(widget, response):
|
|
||||||
if response == "choose_folder":
|
|
||||||
self.choose_folder(widget, set_cache_dir)
|
|
||||||
|
|
||||||
if not (path / "coverart").exists():
|
|
||||||
create_dialog(
|
|
||||||
self.win,
|
|
||||||
_("Cache Not Found"),
|
|
||||||
_("Select the Lutris cache directory."),
|
|
||||||
"choose_folder",
|
|
||||||
_("Set Location"),
|
|
||||||
).connect("response", response)
|
|
||||||
else:
|
|
||||||
self.schema.set_string(
|
|
||||||
"lutris-cache-location",
|
|
||||||
str(path),
|
|
||||||
)
|
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
return
|
||||||
|
|
||||||
|
def response(widget, response):
|
||||||
|
if response == "choose_folder":
|
||||||
|
self.choose_folder(widget, set_cache_dir)
|
||||||
|
|
||||||
|
if not lutris_cache_exists(path).exists():
|
||||||
|
create_dialog(
|
||||||
|
self.win,
|
||||||
|
_("Cache Not Found"),
|
||||||
|
_("Select the Lutris cache directory."),
|
||||||
|
"choose_folder",
|
||||||
|
_("Set Location"),
|
||||||
|
).connect("response", response)
|
||||||
|
|
||||||
self.lutris_cache_file_chooser_button.connect(
|
self.lutris_cache_file_chooser_button.connect(
|
||||||
"clicked", self.choose_folder, set_cache_dir
|
"clicked", self.choose_folder, set_cache_dir
|
||||||
@@ -259,8 +246,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self,
|
self,
|
||||||
"heroic",
|
"heroic",
|
||||||
"Heroic",
|
"Heroic",
|
||||||
"heroic-location",
|
heroic_installed,
|
||||||
["config.json"],
|
|
||||||
self.heroic_expander_row,
|
self.heroic_expander_row,
|
||||||
self.heroic_file_chooser_button,
|
self.heroic_file_chooser_button,
|
||||||
True,
|
True,
|
||||||
@@ -290,8 +276,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self,
|
self,
|
||||||
"bottles",
|
"bottles",
|
||||||
"Bottles",
|
"Bottles",
|
||||||
"bottles-location",
|
bottles_installed,
|
||||||
["library.yml"],
|
|
||||||
self.bottles_expander_row,
|
self.bottles_expander_row,
|
||||||
self.bottles_file_chooser_button,
|
self.bottles_file_chooser_button,
|
||||||
)
|
)
|
||||||
@@ -304,8 +289,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self,
|
self,
|
||||||
"itch",
|
"itch",
|
||||||
"itch",
|
"itch",
|
||||||
"itch-location",
|
itch_installed,
|
||||||
[Path("db") / "butler.db"],
|
|
||||||
self.itch_expander_row,
|
self.itch_expander_row,
|
||||||
self.itch_file_chooser_button,
|
self.itch_file_chooser_button,
|
||||||
True,
|
True,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
def check_install(check, locations, setting=None, subdirs=(Path(),)):
|
def check_install(check, locations, setting=None, subdirs=(Path(),)):
|
||||||
for location in locations:
|
for location in locations:
|
||||||
for subdir in subdirs:
|
for subdir in (Path(),) + subdirs:
|
||||||
if (location / subdir / check).is_file() or (
|
if (location / subdir / check).is_file() or (
|
||||||
location / subdir / check
|
location / subdir / check
|
||||||
).exists():
|
).exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user