From 0f55cbb5272547ea7110feb2f29fd999fced306f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 15 May 2017 11:56:26 +0200 Subject: app-indicator: don't append the snap prefix if the icon is saved in a well known readable path --- src/app-indicator.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index a73e9a4..875c0b1 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -2066,6 +2066,7 @@ get_snap_prefix () static gchar * append_snap_prefix (const gchar *path) { + gint i; gchar real_path[PATH_MAX]; const gchar *snap = get_snap_prefix (); @@ -2079,10 +2080,21 @@ append_snap_prefix (const gchar *path) return NULL; } - if (g_str_has_prefix (path, snap)) { + if (g_str_has_prefix (path, snap) || + g_str_has_prefix (path, g_get_home_dir ()) || + g_str_has_prefix (path, g_get_user_cache_dir ()) || + g_str_has_prefix (path, g_get_user_config_dir ()) || + g_str_has_prefix (path, g_get_user_data_dir ()) || + g_str_has_prefix (path, g_get_user_runtime_dir ())) { return g_strdup (path); } + for (i = 0; i < G_USER_N_DIRECTORIES; ++ i) { + if (g_str_has_prefix (path, g_get_user_special_dir (i))) { + return g_strdup (path); + } + } + return g_build_path (G_DIR_SEPARATOR_S, snap, path, NULL); } -- cgit v1.2.3