Skip to content

Commit 7f31fbf

Browse files
committed
bugfix: firecfg: check full filename in check_profile()
Currently, firecfg only checks the last word in .desktop files when trying to match them to an existing profile. For example: * `org.gnome.gedit.desktop` -> `gedit.desktop` * `org.gnome.seahorse.Application.desktop` -> `Application.desktop` This works in the former case where there is an exact match of the last word on each side (`gedit.desktop` and `gedit.profile`), but not in the latter case (`Application.desktop` and `seahorse.profile`). So make firecfg also check the full filename of the .desktop file, to make it easier to create redirect profiles that match the full name of the .desktop files. For example: * `org.gnome.seahorse.Application.desktop` -> `org.gnome.seahorse.Application.profile` (which itself then redirects to `seahorse.profile`) Related commits: * a6341b9 ("disable DBus activation in firecfg", 2017-09-25) * 3e69deb ("fix firecfg", 2017-09-25) * bd97615 ("Temp fix firecfg (netblue30#2634)", 2019-04-02) Relates to netblue30#2624 netblue30#6658.
1 parent 30ba35f commit 7f31fbf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/firecfg/desktop_files.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ static int have_profile(const char *filename, const char *homedir) {
6767

6868
// we get strange names here, such as .org.gnome.gedit.desktop, com.uploadedlobster.peek.desktop,
6969
// or io.github.Pithos.desktop; extract the word before .desktop
70-
// TODO: implement proper fix for #2624 (names like org.gnome.Logs.desktop fall thru
71-
// the 'last word' logic and don't get installed to ~/.local/share/applications
7270

7371
char *tmpfname = strdup(filename);
7472
if (!tmpfname)
@@ -84,8 +82,17 @@ static int have_profile(const char *filename, const char *homedir) {
8482
free(tmpfname);
8583
return 0;
8684
}
85+
86+
// strip ".desktop"
8787
tmpfname[len - 8] = '\0';
8888

89+
// check full filename (without .desktop)
90+
int rv = check_profile(tmpfname, homedir);
91+
if (rv) {
92+
free(tmpfname);
93+
return rv;
94+
}
95+
8996
// extract last word
9097
char *last_word = strrchr(tmpfname, '.');
9198
if (last_word)
@@ -95,7 +102,7 @@ static int have_profile(const char *filename, const char *homedir) {
95102

96103
// try lowercase
97104
last_word[0] = tolower(last_word[0]);
98-
int rv = check_profile(last_word, homedir);
105+
rv = check_profile(last_word, homedir);
99106
if (rv) {
100107
free(tmpfname);
101108
return rv;

0 commit comments

Comments
 (0)