Example #1
0
    def get_steam_path(self, prefix=None):
        """Return Steam exe's path"""
        custom_path = self.runner_config.get('steam_path') or ''
        if custom_path:
            custom_path = os.path.join(custom_path, 'Steam.exe')
            if os.path.exists(custom_path):
                return custom_path

        candidates = [self.get_default_prefix(), os.path.expanduser("~/.wine")]
        for prefix in candidates:
            # Try the default install path
            steam_path = os.path.join(prefix,
                                      "drive_c/Program Files/Steam/Steam.exe")
            if os.path.exists(steam_path):
                return steam_path

            # Try from the registry key
            user_reg = os.path.join(prefix, "user.reg")
            if not os.path.exists(user_reg):
                continue
            registry = WineRegistry(user_reg)
            steam_path = registry.query("Software/Valve/Steam", "SteamExe")
            if not steam_path:
                steam_path = self.get_open_command(registry)
                if not steam_path:
                    continue
            path = registry.get_unix_path(steam_path)
            path = system.fix_path_case(path)
            if path:
                return path
Example #2
0
 def get_install_path(self):
     if not self.installdir:
         return
     install_path = fix_path_case(os.path.join(self.steamapps_path, "common",
                                               self.installdir))
     if install_path:
         return install_path
Example #3
0
def get_path_from_appmanifest(steamapps_path, appid):
    """Return the path where a Steam game is installed."""
    config = get_manifest_info(steamapps_path, appid)
    if not config:
        return
    installdir = config.get('AppState', {}).get('installdir')
    install_path = fix_path_case(os.path.join(steamapps_path, "common",
                                              installdir))
    if install_path and os.path.exists(install_path):
        return install_path
Example #4
0
 def get_steamapps_dirs(self):
     """Return a list of the Steam library main + custom folders."""
     dirs = []
     # Main steamapps dir
     if self.steam_data_dir:
         main_dir = os.path.join(self.steam_data_dir, 'SteamApps')
         main_dir = system.fix_path_case(main_dir)
         if main_dir:
             dirs.append(main_dir)
     # Custom dirs
     steam_config = self.steam_config
     if steam_config:
         i = 1
         while ('BaseInstallFolder_%s' % i) in steam_config:
             path = steam_config['BaseInstallFolder_%s' % i] + '/SteamApps'
             path = system.fix_path_case(path)
             if path:
                 dirs.append(path)
             i += 1
     return dirs
Example #5
0
 def _find_matching_disc(self, widget, requires):
     drives = devices.get_mounted_discs()
     for drive in drives:
         mount_point = drive.get_root().get_path()
         required_abspath = os.path.join(mount_point, requires)
         required_abspath = system.fix_path_case(required_abspath)
         if required_abspath:
             logger.debug("Found %s on cdrom %s" % (requires, mount_point))
             self.game_disc = mount_point
             self._iter_commands()
             break
Example #6
0
 def steam_data_dir(self):
     """Return dir where Steam files lie."""
     candidates = (
         "~/.local/share/steam/SteamApps",
         "~/.steam/steam/SteamApps",
         "~/.steam/SteamApps",
     )
     for candidate in candidates:
         path = os.path.expanduser(candidate)
         path = system.fix_path_case(path)
         if path:
             return path.rstrip('sSteamAp')
Example #7
0
 def _find_matching_disc(self, _widget, requires, extra_path=None):
     if extra_path:
         drives = [extra_path]
     else:
         drives = disks.get_mounted_discs()
     for drive in drives:
         required_abspath = os.path.join(drive, requires)
         required_abspath = system.fix_path_case(required_abspath)
         if required_abspath:
             logger.debug("Found %s on cdrom %s", requires, drive)
             self.game_disc = drive
             self._iter_commands()
             break
Example #8
0
 def get_steamapps_dirs(self):
     """Return a list of the Steam library main + custom folders."""
     dirs = []
     # Main steamapps dir
     steam_data_dir = self.steam_data_dir
     if steam_data_dir:
         main_dir = os.path.join(steam_data_dir, "steamapps")
         main_dir = system.fix_path_case(main_dir)
         if main_dir and os.path.isdir(main_dir):
             dirs.append(os.path.abspath(main_dir))
     # Custom dirs
     steam_config = self.get_steam_config()
     if steam_config:
         i = 1
         while "BaseInstallFolder_%s" % i in steam_config:
             path = steam_config["BaseInstallFolder_%s" % i] + "/steamapps"
             linux_path = self.parse_wine_path(path, self.prefix_path)
             linux_path = system.fix_path_case(linux_path)
             if linux_path and os.path.isdir(linux_path):
                 dirs.append(os.path.abspath(linux_path))
             i += 1
     return dirs
Example #9
0
    def get_steamapps_dirs(self):
        """Return a list of the Steam library main + custom folders."""
        dirs = []
        # Main steamapps dir and compatibilitytools.d dir
        for data_dir in self.data_dir_candidates:
            for _dir in ["SteamApps", "compatibilitytools.d"]:
                abs_dir = os.path.join(os.path.expanduser(data_dir), _dir)
                abs_dir = system.fix_path_case(abs_dir)
                if abs_dir and os.path.isdir(abs_dir):
                    dirs.append(abs_dir)

        # Custom dirs
        steam_config = self.get_steam_config()
        if steam_config:
            i = 1
            while "BaseInstallFolder_%s" % i in steam_config:
                path = steam_config["BaseInstallFolder_%s" % i] + "/SteamApps"
                path = system.fix_path_case(path)
                if path and os.path.isdir(path):
                    dirs.append(path)
                i += 1
        return dirs
Example #10
0
 def steam_data_dir(self):
     """Return dir where Steam files lie."""
     candidates = (
         "~/.steam",
         "~/.local/share/steam",
         "~/.steam/steam",
         "~/.var/app/com.valvesoftware.Steam/data/steam",
     )
     for candidate in candidates:
         path = system.fix_path_case(
             os.path.join(os.path.expanduser(candidate), "SteamApps"))
         if path:
             return path[:-len("SteamApps")]
Example #11
0
 def get_steamapps_dirs(self):
     """Return a list of the Steam library main + custom folders."""
     dirs = []
     # Main steamapps dir
     steam_data_dir = self.steam_data_dir
     if steam_data_dir:
         main_dir = os.path.join(steam_data_dir, 'steamapps')
         main_dir = system.fix_path_case(main_dir)
         if main_dir and os.path.isdir(main_dir):
             dirs.append(main_dir)
     # Custom dirs
     steam_config = self.get_steam_config()
     if steam_config:
         i = 1
         while ('BaseInstallFolder_%s' % i) in steam_config:
             path = steam_config['BaseInstallFolder_%s' % i] + '/steamapps'
             linux_path = self.parse_wine_path(path, self.prefix_path)
             linux_path = system.fix_path_case(linux_path)
             if linux_path and os.path.isdir(linux_path):
                 dirs.append(linux_path)
             i += 1
     return dirs
Example #12
0
 def _find_matching_disc(self, widget, requires, extra_path=None):
     if extra_path:
         drives = [extra_path]
     else:
         drives = disks.get_mounted_discs()
     for drive in drives:
         required_abspath = os.path.join(drive, requires)
         required_abspath = system.fix_path_case(required_abspath)
         if required_abspath:
             logger.debug("Found %s on cdrom %s" % (requires, drive))
             self.game_disc = drive
             self._iter_commands()
             break
Example #13
0
 def steamapps_paths(self):
     """Return steamapps paths"""
     steam_game = self.get_steam()
     if not steam_game:
         return []
     dirs = []
     steam_path = steam_game.config.game_config["exe"]
     steam_data_dir = os.path.dirname(steam_path)
     if steam_data_dir:
         main_dir = os.path.join(steam_data_dir, "steamapps")
         main_dir = system.fix_path_case(main_dir)
         if main_dir and os.path.isdir(main_dir):
             dirs.append(os.path.abspath(main_dir))
     return dirs
Example #14
0
    def get_steamapps_dirs(self):
        """Return a list of the Steam library main + custom folders."""
        dirs = []

        # Main steamapps dir and compatibilitytools.d dir
        if self.steam_data_dir:
            for _dir in ["SteamApps", "compatibilitytools.d"]:
                abs_dir = os.path.join(self.steam_data_dir, _dir)
                abs_dir = system.fix_path_case(abs_dir)
                if abs_dir and os.path.isdir(abs_dir):
                    dirs.append(abs_dir)

        # Custom dirs
        steam_config = self.get_steam_config()
        if steam_config:
            i = 1
            while "BaseInstallFolder_%s" % i in steam_config:
                path = steam_config["BaseInstallFolder_%s" % i] + "/SteamApps"
                path = system.fix_path_case(path)
                if path and os.path.isdir(path):
                    dirs.append(path)
                i += 1
        return dirs
Example #15
0
 def steam_data_dir(self):
     """Return dir where Steam files lie."""
     candidates = (
         "~/.steam",
         "~/.local/share/steam",
         "~/.steam/steam",
         "~/.var/app/com.valvesoftware.Steam/data/steam",
     )
     for candidate in candidates:
         path = system.fix_path_case(
             os.path.join(os.path.expanduser(candidate), "SteamApps")
         )
         if path:
             return path[: -len("SteamApps")]
Example #16
0
 def steam_path(self, prefix=None):
     """Return Steam exe's path"""
     if not prefix:
         prefix = os.path.expanduser("~/.wine")
     user_reg = os.path.join(prefix, "user.reg")
     if not os.path.exists(user_reg):
         return
     registry = WineRegistry(user_reg)
     steam_path = registry.query("Software/Valve/Steam", "SteamExe")
     if not steam_path:
         steam_path = self.get_open_command(registry)
         if not steam_path:
             return
     path = registry.get_unix_path(steam_path)
     return fix_path_case(path)
Example #17
0
 def steam_path(self, prefix=None):
     """Return Steam exe's path"""
     if not prefix:
         prefix = os.path.expanduser("~/.wine")
     user_reg = os.path.join(prefix, "user.reg")
     if not os.path.exists(user_reg):
         return
     registry = WineRegistry(user_reg)
     steam_path = registry.query("Software/Valve/Steam", "SteamExe")
     if not steam_path:
         steam_path = self.get_open_command(registry)
         if not steam_path:
             return
     path = registry.get_unix_path(steam_path)
     return fix_path_case(path)
Example #18
0
def get_game_config(task, gog_game_path):
    config = {}
    if "path" not in task:
        return
    exe = task["path"]
    exe_abspath = system.fix_path_case(os.path.join(gog_game_path, exe))
    if os.path.exists(exe_abspath):
        exe = exe_abspath
    else:
        logger.warning("No executable found at %s", exe_abspath)
    config["exe"] = exe
    if task.get("workingDir"):
        config["working_dir"] = task["workingDir"]
    if task.get("arguments"):
        config["args"] = task["arguments"]
    if task.get("name"):
        config["name"] = task["name"]
    return config
Example #19
0
 def get_steamapps_dirs(self):
     """Return a list of the Steam library main + custom folders."""
     dirs = []
     # Main steamapps dir
     if self.steam_data_dir:
         main_dir = os.path.join(self.steam_data_dir, 'SteamApps')
         main_dir = system.fix_path_case(main_dir)
         if main_dir:
             dirs.append(main_dir)
     # Custom dirs
     steam_config = self.steam_config
     if steam_config:
         i = 1
         while ('BaseInstallFolder_%s' % i) in steam_config:
             path = steam_config['BaseInstallFolder_%s' % i] + '/SteamApps'
             if os.path.exists(path):
                 dirs.append(path)
             i += 1
     return dirs
Example #20
0
    def get_steam_path(self):
        """Return Steam exe's path"""
        custom_path = self.runner_config.get("steam_path") or ""
        if custom_path:
            custom_path = os.path.abspath(
                os.path.expanduser(os.path.join(custom_path, "Steam.exe"))
            )
            if system.path_exists(custom_path):
                return custom_path

        candidates = [
            self.get_default_prefix(arch="win64"),
            self.get_default_prefix(arch="win32"),
            os.path.expanduser("~/.wine"),
        ]
        for prefix in candidates:
            # Try the default install path
            for default_path in [
                    "drive_c/Program Files (x86)/Steam/Steam.exe",
                    "drive_c/Program Files/Steam/Steam.exe",
            ]:
                steam_path = os.path.join(prefix, default_path)
                if system.path_exists(steam_path):
                    return steam_path

            # Try from the registry key
            user_reg = os.path.join(prefix, "user.reg")
            if not system.path_exists(user_reg):
                continue
            registry = WineRegistry(user_reg)
            steam_path = registry.query("Software/Valve/Steam", "SteamExe")
            if not steam_path:
                steam_path = self.get_open_command(registry)
                if not steam_path:
                    continue
            return system.fix_path_case(registry.get_unix_path(steam_path))
        return ""
Example #21
0
    def get_steam_path(self):
        """Return Steam exe's path"""
        custom_path = self.runner_config.get("steam_path") or ""
        if custom_path:
            custom_path = os.path.abspath(
                os.path.expanduser(os.path.join(custom_path, "Steam.exe"))
            )
            if system.path_exists(custom_path):
                return custom_path

        candidates = [
            self.get_default_prefix(arch="win64"),
            self.get_default_prefix(arch="win32"),
            os.path.expanduser("~/.wine"),
        ]
        for prefix in candidates:
            # Try the default install path
            for default_path in [
                    "drive_c/Program Files (x86)/Steam/Steam.exe",
                    "drive_c/Program Files/Steam/Steam.exe",
            ]:
                steam_path = os.path.join(prefix, default_path)
                if system.path_exists(steam_path):
                    return steam_path

            # Try from the registry key
            user_reg = os.path.join(prefix, "user.reg")
            if not system.path_exists(user_reg):
                continue
            registry = WineRegistry(user_reg)
            steam_path = registry.query("Software/Valve/Steam", "SteamExe")
            if not steam_path:
                steam_path = self.get_open_command(registry)
                if not steam_path:
                    continue
            return system.fix_path_case(registry.get_unix_path(steam_path))