This commit is contained in:
Sam Moore 2024-08-28 00:05:43 -04:00 committed by GitHub
commit 69c4fad556
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,7 @@ import os
import subprocess
_logger = logging.getLogger('CXHelpers')
bottles_dir = os.environ["CX_BOTTLE_PATH"] if "CX_BOTTLE_PATH" in os.environ else '~/Library/Application Support/CrossOver/Bottles'
def mac_get_crossover_version(app_path):
try:
@ -37,19 +37,19 @@ def mac_find_crossover_apps():
def mac_get_crossover_bottles():
bottles_path = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
bottles_path = os.path.expanduser(bottles_dir)
if not os.path.exists(bottles_path):
return []
return sorted(p for p in os.listdir(bottles_path) if mac_is_valid_bottle(p))
def mac_is_valid_bottle(bottle_name):
bottles_path = os.path.expanduser('~/Library/Application Support/CrossOver/Bottles')
bottles_path = os.path.expanduser(bottles_dir)
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')
bottles_path = os.path.expanduser(bottles_dir)
return os.path.join(bottles_path, bottle_name)