Adapt user_data_dir when executed in a Flatpak

This commit is contained in:
Mathieu Comandon 2023-10-16 05:24:23 -07:00
parent 132dfdb805
commit 0531e7f9c6

View file

@ -101,7 +101,8 @@ def create_launcher(game_slug, game_id, game_name, launch_config_name=None, desk
logger.debug("Creating Desktop icon in %s", launcher_path)
shutil.copy(tmp_launcher_path, launcher_path)
if menu:
menu_path = os.path.join(GLib.get_user_data_dir(), "applications")
user_dir = os.path.expanduser("~/.local/share") if LINUX_SYSTEM.is_flatpak else GLib.get_user_data_dir()
menu_path = os.path.join(user_dir, "applications")
os.makedirs(menu_path, exist_ok=True)
launcher_path = os.path.join(menu_path, launcher_filename)
logger.debug("Creating menu launcher in %s", launcher_path)