Merge lp:~3v1n0/libappindicator/snap-prefix-ignore-well-known-dirs into lp:libappindicator/16.10

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 281
Merged at revision: 281
Proposed branch: lp:~3v1n0/libappindicator/snap-prefix-ignore-well-known-dirs
Merge into: lp:libappindicator/16.10
Diff against target: 33 lines (+13/-1)
1 file modified
src/app-indicator.c (+13/-1)
To merge this branch: bzr merge lp:~3v1n0/libappindicator/snap-prefix-ignore-well-known-dirs
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+317330@code.launchpad.net

Commit message

app-indicator: don't append the snap prefix if the icon is saved in a well known readable path

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app-indicator.c'
2--- src/app-indicator.c 2017-02-13 17:12:29 +0000
3+++ src/app-indicator.c 2017-02-15 14:12:39 +0000
4@@ -2066,6 +2066,7 @@
5 static gchar *
6 append_snap_prefix (const gchar *path)
7 {
8+ gint i;
9 gchar real_path[PATH_MAX];
10 const gchar *snap = get_snap_prefix ();
11
12@@ -2079,10 +2080,21 @@
13 return NULL;
14 }
15
16- if (g_str_has_prefix (path, snap)) {
17+ if (g_str_has_prefix (path, snap) ||
18+ g_str_has_prefix (path, g_get_home_dir ()) ||
19+ g_str_has_prefix (path, g_get_user_cache_dir ()) ||
20+ g_str_has_prefix (path, g_get_user_config_dir ()) ||
21+ g_str_has_prefix (path, g_get_user_data_dir ()) ||
22+ g_str_has_prefix (path, g_get_user_runtime_dir ())) {
23 return g_strdup (path);
24 }
25
26+ for (i = 0; i < G_USER_N_DIRECTORIES; ++ i) {
27+ if (g_str_has_prefix (path, g_get_user_special_dir (i))) {
28+ return g_strdup (path);
29+ }
30+ }
31+
32 return g_build_path (G_DIR_SEPARATOR_S, snap, path, NULL);
33 }
34

Subscribers

People subscribed via source and target branches