diff options
Diffstat (limited to 'src/firecfg/desktop_files.c')
-rw-r--r-- | src/firecfg/desktop_files.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/firecfg/desktop_files.c b/src/firecfg/desktop_files.c index 8918b8a95..ecb18a60e 100644 --- a/src/firecfg/desktop_files.c +++ b/src/firecfg/desktop_files.c | |||
@@ -118,6 +118,9 @@ void fix_desktop_files(const char *homedir) { | |||
118 | exit(1); | 118 | exit(1); |
119 | } | 119 | } |
120 | 120 | ||
121 | // build ignorelist | ||
122 | parse_config_all(0); | ||
123 | |||
121 | // destination | 124 | // destination |
122 | // create ~/.local/share/applications directory if necessary | 125 | // create ~/.local/share/applications directory if necessary |
123 | char *user_apps_dir; | 126 | char *user_apps_dir; |
@@ -163,7 +166,8 @@ void fix_desktop_files(const char *homedir) { | |||
163 | // copy | 166 | // copy |
164 | struct dirent *entry; | 167 | struct dirent *entry; |
165 | while ((entry = readdir(dir)) != NULL) { | 168 | while ((entry = readdir(dir)) != NULL) { |
166 | if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) | 169 | const char *filename = entry->d_name; |
170 | if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) | ||
167 | continue; | 171 | continue; |
168 | 172 | ||
169 | // skip if not regular file or link | 173 | // skip if not regular file or link |
@@ -172,10 +176,25 @@ void fix_desktop_files(const char *homedir) { | |||
172 | continue; | 176 | continue; |
173 | 177 | ||
174 | // skip if not .desktop file | 178 | // skip if not .desktop file |
175 | if (strstr(entry->d_name,".desktop") != (entry->d_name+strlen(entry->d_name)-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); | ||
176 | continue; | 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); | ||
194 | continue; | ||
195 | } | ||
177 | 196 | ||
178 | char *filename = entry->d_name; | 197 | free(exec); |
179 | 198 | ||
180 | // skip links - Discord on Arch #4235 seems to be a symlink to /opt directory | 199 | // skip links - Discord on Arch #4235 seems to be a symlink to /opt directory |
181 | // if (is_link(filename)) | 200 | // if (is_link(filename)) |
@@ -221,7 +240,7 @@ void fix_desktop_files(const char *homedir) { | |||
221 | } | 240 | } |
222 | 241 | ||
223 | // get executable name | 242 | // get executable name |
224 | char *ptr = strstr(buf,"\nExec="); | 243 | ptr = strstr(buf,"\nExec="); |
225 | if (!ptr || strlen(ptr) < 7) { | 244 | if (!ptr || strlen(ptr) < 7) { |
226 | if (arg_debug) | 245 | if (arg_debug) |
227 | printf(" %s - skipped: wrong format?\n", filename); | 246 | printf(" %s - skipped: wrong format?\n", filename); |