示例#1
0
文件: steam.py 项目: Ryochan7/lutris
 def __init__(self, appmanifest_path):
     self.appmanifest_path = appmanifest_path
     self.steamapps_path, filename = os.path.split(appmanifest_path)
     self.steamid = re.findall(r'(\d+)', filename)[-1]
     if os.path.exists(appmanifest_path):
         with open(appmanifest_path, "r") as appmanifest_file:
             self.appmanifest_data = vdf_parse(appmanifest_file, {})
示例#2
0
文件: steam.py 项目: yunusem/lutris
 def __init__(self, appmanifest_path):
     self.appmanifest_path = appmanifest_path
     self.steamapps_path, filename = os.path.split(appmanifest_path)
     self.steamid = re.findall(r'(\d+)', filename)[-1]
     if os.path.exists(appmanifest_path):
         with open(appmanifest_path, "r") as appmanifest_file:
             self.appmanifest_data = vdf_parse(appmanifest_file, {})
示例#3
0
    def __init__(self, appmanifest_path):
        self.appmanifest_path = appmanifest_path
        self.steamapps_path, filename = os.path.split(appmanifest_path)
        self.steamid = re.findall(r'(\d+)', filename)[-1]
        self.appmanifest_data = {}

        if path_exists(appmanifest_path):
            with open(appmanifest_path, "r") as appmanifest_file:
                self.appmanifest_data = vdf_parse(appmanifest_file, {})
        else:
            logger.error("Path to AppManifest file %s doesn't exist",
                         appmanifest_path)
示例#4
0
 def _get_installed_steamapps(runner):
     """Return a list of appIDs of the installed Steam games."""
     if not runner.is_installed():
         return []
     installed = []
     dirs = runner.get_steamapps_dirs()
     for dirname in dirs:
         appmanifests = [f for f in os.listdir(dirname) if re.match(r"^appmanifest_\d+.acf$", f)]
         for filename in appmanifests:
             basename, ext = os.path.splitext(filename)
             steamid = int(basename[12:])
             appmanifest_path = os.path.join(dirname, "appmanifest_%s.acf" % str(steamid))
             with open(appmanifest_path, "r") as appmanifest_file:
                 appmanifest = vdf_parse(appmanifest_file, {})
             appstate = appmanifest.get("AppState") or {}
             is_installed = appstate.get("LastOwner") or "0"
             if not is_installed == "0":
                 installed.append(steamid)
     return installed
示例#5
0
 def _get_installed_steamapps(runner):
     """Return a list of appIDs of the installed Steam games."""
     if not runner.is_installed():
         return []
     installed = []
     dirs = runner.get_steamapps_dirs()
     for dirname in dirs:
         appmanifests = [f for f in os.listdir(dirname)
                         if re.match(r'^appmanifest_\d+.acf$', f)]
         for filename in appmanifests:
             basename, ext = os.path.splitext(filename)
             steamid = int(basename[12:])
             appmanifest_path = os.path.join(
                 dirname, "appmanifest_%s.acf" % str(steamid)
             )
             with open(appmanifest_path, "r") as appmanifest_file:
                 appmanifest = vdf_parse(appmanifest_file, {})
             appstate = appmanifest.get('AppState') or {}
             is_installed = appstate.get('LastOwner') or '0'
             if not is_installed == '0':
                 installed.append(steamid)
     return installed