mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[core/utils] Clean up crossover bottle code a bit
This commit is contained in:
parent
d15f05fc60
commit
ecb230511f
|
@ -33,7 +33,7 @@ from legendary.models.game import *
|
||||||
from legendary.models.json_manifest import JSONManifest
|
from legendary.models.json_manifest import JSONManifest
|
||||||
from legendary.models.manifest import Manifest, ManifestMeta
|
from legendary.models.manifest import Manifest, ManifestMeta
|
||||||
from legendary.models.chunk import Chunk
|
from legendary.models.chunk import Chunk
|
||||||
from legendary.utils.crossover import mac_find_crossover_apps, mac_get_crossover_version
|
from legendary.utils.crossover import mac_find_crossover_apps, mac_get_crossover_version, mac_get_bottle_path
|
||||||
from legendary.utils.egl_crypt import decrypt_epic_data
|
from legendary.utils.egl_crypt import decrypt_epic_data
|
||||||
from legendary.utils.env import is_windows_mac_or_pyi
|
from legendary.utils.env import is_windows_mac_or_pyi
|
||||||
from legendary.utils.eos import EOSOverlayApp, query_registry_entries
|
from legendary.utils.eos import EOSOverlayApp, query_registry_entries
|
||||||
|
@ -1839,9 +1839,7 @@ class LegendaryCore:
|
||||||
manifest = self.load_manifest(r.content)
|
manifest = self.load_manifest(r.content)
|
||||||
base_url = manifest_url.rpartition('/')[0]
|
base_url = manifest_url.rpartition('/')[0]
|
||||||
|
|
||||||
bottles_dir = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
path = mac_get_bottle_path(bottle_name)
|
||||||
path = os.path.join(bottles_dir, bottle_name)
|
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
raise FileExistsError(f'Bottle {bottle_name} already exists')
|
raise FileExistsError(f'Bottle {bottle_name} already exists')
|
||||||
|
|
||||||
|
@ -1862,8 +1860,7 @@ class LegendaryCore:
|
||||||
return dlm, analysis_result, path
|
return dlm, analysis_result, path
|
||||||
|
|
||||||
def finish_bottle_setup(self, bottle_name):
|
def finish_bottle_setup(self, bottle_name):
|
||||||
bottles_dir = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
path = mac_get_bottle_path(bottle_name)
|
||||||
path = os.path.join(bottles_dir, bottle_name)
|
|
||||||
|
|
||||||
self.log.info('Creating bottle symlinks...')
|
self.log.info('Creating bottle symlinks...')
|
||||||
symlinks = [
|
symlinks = [
|
||||||
|
@ -1888,8 +1885,7 @@ class LegendaryCore:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_bottle(bottle_name):
|
def remove_bottle(bottle_name):
|
||||||
bottles_dir = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
path = mac_get_bottle_path(bottle_name)
|
||||||
path = os.path.join(bottles_dir, bottle_name)
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
delete_folder(path, recursive=True)
|
delete_folder(path, recursive=True)
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,7 @@ def mac_get_crossover_bottles():
|
||||||
bottles_path = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
bottles_path = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
||||||
if not os.path.exists(bottles_path):
|
if not os.path.exists(bottles_path):
|
||||||
return []
|
return []
|
||||||
return sorted(p for p in os.listdir(bottles_path) if
|
return sorted(p for p in os.listdir(bottles_path) if mac_is_valid_bottle(p))
|
||||||
os.path.isdir(os.path.join(bottles_path, p)) and
|
|
||||||
os.path.exists(os.path.join(bottles_path, p, 'cxbottle.conf')))
|
|
||||||
|
|
||||||
|
|
||||||
def mac_is_valid_bottle(bottle_name):
|
def mac_is_valid_bottle(bottle_name):
|
||||||
|
@ -50,6 +48,11 @@ def mac_is_valid_bottle(bottle_name):
|
||||||
return os.path.exists(os.path.join(bottles_path, bottle_name, 'cxbottle.conf'))
|
return os.path.exists(os.path.join(bottles_path, bottle_name, 'cxbottle.conf'))
|
||||||
|
|
||||||
|
|
||||||
|
def mac_get_bottle_path(bottle_name):
|
||||||
|
bottles_path = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
|
||||||
|
return os.path.join(bottles_path, bottle_name)
|
||||||
|
|
||||||
|
|
||||||
def mac_is_crossover_running():
|
def mac_is_crossover_running():
|
||||||
try:
|
try:
|
||||||
out = subprocess.check_output(['launchctl', 'list'])
|
out = subprocess.check_output(['launchctl', 'list'])
|
||||||
|
|
Loading…
Reference in a new issue