diff --git a/rare/components/tabs/settings/widgets/proton.py b/rare/components/tabs/settings/widgets/proton.py index 110db4ab..658aaf87 100644 --- a/rare/components/tabs/settings/widgets/proton.py +++ b/rare/components/tabs/settings/widgets/proton.py @@ -9,37 +9,13 @@ from PyQt5.QtWidgets import QGroupBox, QFileDialog from rare.components.tabs.settings import LinuxSettings from rare.shared import LegendaryCoreSingleton from rare.ui.components.tabs.settings.proton import Ui_ProtonSettings -from rare.utils import config_helper +from rare.utils import config_helper, proton from rare.widgets.indicator_edit import PathEdit, IndicatorReasonsCommon from .wrapper import WrapperSettings logger = getLogger("Proton") -def find_proton_combos(): - possible_proton_combos = [] - compatibilitytools_dirs = [ - os.path.expanduser("~/.steam/steam/steamapps/common"), - "/usr/share/steam/compatibilitytools.d", - os.path.expanduser("~/.steam/compatibilitytools.d"), - os.path.expanduser("~/.steam/root/compatibilitytools.d"), - ] - for c in compatibilitytools_dirs: - if os.path.exists(c): - for i in os.listdir(c): - proton = os.path.join(c, i, "proton") - compatibilitytool = os.path.join(c, i, "compatibilitytool.vdf") - toolmanifest = os.path.join(c, i, "toolmanifest.vdf") - if os.path.exists(proton) and ( - os.path.exists(compatibilitytool) or os.path.exists(toolmanifest) - ): - wrapper = f'"{proton}" run' - possible_proton_combos.append(wrapper) - if not possible_proton_combos: - logger.warning("Unable to find any Proton version") - return possible_proton_combos - - class ProtonSettings(QGroupBox): # str: option key environ_changed = pyqtSignal(str) @@ -53,7 +29,7 @@ class ProtonSettings(QGroupBox): self._linux_settings = linux_settings self._wrapper_settings = wrapper_settings self.core = LegendaryCoreSingleton() - self.possible_proton_combos = find_proton_combos() + self.possible_proton_combos = proton.find_proton_combos() self.ui.proton_combo.addItems(self.possible_proton_combos) self.ui.proton_combo.currentIndexChanged.connect(self.change_proton) diff --git a/rare/utils/proton.py b/rare/utils/proton.py new file mode 100644 index 00000000..371f2133 --- /dev/null +++ b/rare/utils/proton.py @@ -0,0 +1,28 @@ +import os +from logging import getLogger + +logger = getLogger("Proton") + + +def find_proton_combos(): + possible_proton_combos = [] + compatibilitytools_dirs = [ + os.path.expanduser("~/.steam/steam/steamapps/common"), + "/usr/share/steam/compatibilitytools.d", + os.path.expanduser("~/.steam/compatibilitytools.d"), + os.path.expanduser("~/.steam/root/compatibilitytools.d"), + ] + for c in compatibilitytools_dirs: + if os.path.exists(c): + for i in os.listdir(c): + proton = os.path.join(c, i, "proton") + compatibilitytool = os.path.join(c, i, "compatibilitytool.vdf") + toolmanifest = os.path.join(c, i, "toolmanifest.vdf") + if os.path.exists(proton) and ( + os.path.exists(compatibilitytool) or os.path.exists(toolmanifest) + ): + wrapper = f'"{proton}" run' + possible_proton_combos.append(wrapper) + if not possible_proton_combos: + logger.warning("Unable to find any Proton version") + return possible_proton_combos