Skip to content

Commit a9c851e

Browse files
committed
firecfg: use ignorelist also for .desktop files
Closes netblue30#5245. Relates to netblue30#5876.
1 parent 358af63 commit a9c851e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/firecfg/desktop_files.c

+22-2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ void fix_desktop_files(const char *homedir) {
118118
exit(1);
119119
}
120120

121+
// build ignorelist
122+
parse_config_all(0);
123+
121124
// destination
122125
// create ~/.local/share/applications directory if necessary
123126
char *user_apps_dir;
@@ -173,8 +176,25 @@ void fix_desktop_files(const char *homedir) {
173176
continue;
174177

175178
// skip if not .desktop file
176-
if (strstr(filename, ".desktop") != (filename + strlen(filename) - 8))
179+
char *exec = strdup(filename);
180+
if (!exec)
181+
errExit("strdup");
182+
char *ptr = strstr(exec, ".desktop");
183+
if (ptr == NULL || *(ptr + 8) != '\0') {
184+
printf(" %s skipped (not a .desktop file)\n", exec);
185+
free(exec);
186+
continue;
187+
}
188+
189+
// skip if program is in ignorelist
190+
*ptr = '\0';
191+
if (in_ignorelist(exec)) {
192+
printf(" %s ignored\n", exec);
193+
free(exec);
177194
continue;
195+
}
196+
197+
free(exec);
178198

179199
// skip links - Discord on Arch #4235 seems to be a symlink to /opt directory
180200
// if (is_link(filename))
@@ -220,7 +240,7 @@ void fix_desktop_files(const char *homedir) {
220240
}
221241

222242
// get executable name
223-
char *ptr = strstr(buf,"\nExec=");
243+
ptr = strstr(buf,"\nExec=");
224244
if (!ptr || strlen(ptr) < 7) {
225245
if (arg_debug)
226246
printf(" %s - skipped: wrong format?\n", filename);

src/man/firecfg.1.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Configuration file syntax:
168168
A line that starts with \fB#\fR is considered a comment.
169169
.br
170170
A line that starts with \fB!PROGRAM\fR means to ignore "PROGRAM" when creating
171-
symlinks.
171+
symlinks and fixing .desktop files.
172172
.br
173173
A line that starts with anything else is considered to be the name of an
174174
executable and firecfg will attempt to create a symlink for it.

0 commit comments

Comments
 (0)