mirror of
https://github.com/bottlesdevs/Bottles.git
synced 2026-10-29 15:27:13 +08:00
* refactor: migrate config from dict to object * fix: type hint import * fix: BottleConfig.load() * fix: config loading in BackupManager.import_backup() * fix: Remove unused import * fix: more guard code, type hints and Config object usage * fix: a potential crash when SteamManager.get_app_config() failed * Revert "fix: Remove unused import" This reverts commit2d48a4e08a. * add: new config field * fix: Config object value read * misc: remove review TODO comments * adapt to new BottleConfig object * fix RunAsync usage * add: BottleConfig._fix() * fix: type hint and Config object usage * fix: typo in FSR setting default value * adapt to new BottleConfig object * remove unnecessary DictCompat method * add: BottleConfig._filter() * fix: TemplateManager.new() * misc: critical guard code * fix: typo in commitb7ed61e678* misc: more type hinting * Revert "remove unnecessary DictCompat method" This reverts commit265633e733. * fix crash when user choose Cancel in ProtonAlertDialog * fix force stop all programs not work * adapt NVAPIComponent.check_bottle_nvngx to Config object * Better DictCompatMixIn * InstallerManager.__set_parameters incorrect adopt * fix typo incbe1dc760b* adopt LibraryManager.download_thumbnail to Config object * serialize Config object to yaml automatically * fix translation and remove workaround in0830fddbc9* fix missing locale for Chinese * comment * fix incorrect variable init position * remove 'in' extensions and some bugfix * fix executable filemode Co-authored-by: Mirko Brombin <send@mirko.pm>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
# origin.py
|
|
#
|
|
# Copyright 2022 brombinmirko <send@mirko.pm>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, in version 3 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
import os
|
|
import uuid
|
|
import json
|
|
from typing import Union, NewType
|
|
|
|
from bottles.backend.logger import Logger
|
|
from bottles.backend.models.config import BottleConfig
|
|
from bottles.backend.utils.manager import ManagerUtils
|
|
|
|
|
|
class OriginManager:
|
|
|
|
@staticmethod
|
|
def find_manifests_path(config: BottleConfig) -> Union[str, None]:
|
|
"""
|
|
Finds the Origin manifests path.
|
|
"""
|
|
paths = [
|
|
os.path.join(
|
|
ManagerUtils.get_bottle_path(config),
|
|
"drive_c/ProgramData/Origin/LocalContent")
|
|
]
|
|
|
|
for path in paths:
|
|
if os.path.exists(path):
|
|
return path
|
|
return None
|
|
|
|
@staticmethod
|
|
def is_origin_supported(config: BottleConfig) -> bool:
|
|
"""
|
|
Checks if Origin is supported.
|
|
"""
|
|
return OriginManager.find_manifests_path(config) is not None
|
|
|
|
@staticmethod
|
|
def get_installed_games(config: BottleConfig) -> list:
|
|
"""
|
|
Gets the games.
|
|
"""
|
|
games = []
|
|
return games
|