mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core] Adjust default install paths
- Native Mac apps should go into /Applications - On Windows we keep %USERPROFILE%\legendary for now - On Linux we use ~/Games/legendary now to keep the home folder more tidy
This commit is contained in:
parent
bec119bc03
commit
005089ee9b
|
@ -1246,13 +1246,16 @@ class LegendaryCore:
|
||||||
get('FolderName', {}).get('value', game.app_name)
|
get('FolderName', {}).get('value', game.app_name)
|
||||||
|
|
||||||
if not base_path:
|
if not base_path:
|
||||||
base_path = self.get_default_install_dir()
|
base_path = self.get_default_install_dir(platform=platform)
|
||||||
|
|
||||||
# make sure base directory actually exists (but do not create game dir)
|
# make sure base directory actually exists (but do not create game dir)
|
||||||
if not os.path.exists(base_path):
|
if not os.path.exists(base_path):
|
||||||
self.log.info(f'"{base_path}" does not exist, creating...')
|
self.log.info(f'"{base_path}" does not exist, creating...')
|
||||||
os.makedirs(base_path)
|
os.makedirs(base_path)
|
||||||
|
|
||||||
|
if platform == 'Mac':
|
||||||
|
install_path = base_path
|
||||||
|
else:
|
||||||
install_path = os.path.join(base_path, game_folder)
|
install_path = os.path.join(base_path, game_folder)
|
||||||
|
|
||||||
self.log.info(f'Install path: {install_path}')
|
self.log.info(f'Install path: {install_path}')
|
||||||
|
@ -1424,8 +1427,15 @@ class LegendaryCore:
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_default_install_dir(self):
|
def get_default_install_dir(self, platform='Windows'):
|
||||||
return os.path.expanduser(self.lgd.config.get('Legendary', 'install_dir', fallback='~/legendary'))
|
if platform == 'Mac':
|
||||||
|
_fallback = '/Applications'
|
||||||
|
elif os.name == 'nt':
|
||||||
|
_fallback = '~/legendary'
|
||||||
|
else:
|
||||||
|
_fallback = '~/Games/legendary'
|
||||||
|
|
||||||
|
return os.path.expanduser(self.lgd.config.get('Legendary', 'install_dir', fallback=_fallback))
|
||||||
|
|
||||||
def install_game(self, installed_game: InstalledGame) -> dict:
|
def install_game(self, installed_game: InstalledGame) -> dict:
|
||||||
if self.egl_sync_enabled and not installed_game.is_dlc and installed_game.platform.startswith('Win'):
|
if self.egl_sync_enabled and not installed_game.is_dlc and installed_game.platform.startswith('Win'):
|
||||||
|
|
Loading…
Reference in a new issue