Skip to content

Commit

Permalink
dynamic-launcher: Ensure $XDG_DATA_HOME/applications exists
Browse files Browse the repository at this point in the history
It is possible that the directory has not been created by anything else
before which would make dynamic launcher creation fail.

Resolves: flatpak#1583
  • Loading branch information
swick committed Jan 21, 2025
1 parent f3a42ff commit 50b3510
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dynamic-launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ write_keyfile_to_disk (const char *desktop_file_id,
{
g_autofree char *desktop_dir = NULL;
g_autofree char *desktop_path = NULL;
g_autofree char *link_dir = NULL;
g_autofree char *link_path = NULL;
g_autofree char *relative_path = NULL;
g_autoptr(GFile) link_file = NULL;
Expand All @@ -262,10 +263,11 @@ write_keyfile_to_disk (const char *desktop_file_id,
/* Make a sym link in ~/.local/share/applications so the launcher shows up in
* the desktop environment's menu.
*/
link_path = g_build_filename (g_get_user_data_dir (),
"applications",
desktop_file_id,
NULL);
link_dir = g_build_filename (g_get_user_data_dir (),
"applications",
NULL);
g_mkdir_with_parents (link_dir, 0700);
link_path = g_build_filename (link_dir, desktop_file_id, NULL);

relative_path = g_build_filename ("..",
XDG_PORTAL_APPLICATIONS_DIR,
Expand Down

0 comments on commit 50b3510

Please sign in to comment.