153
153
if (iconName[0] != '/') {
157
static const char *iconExtensions[] = {
158
"", // MUST be first entry.
158
165
myIconName = NULL;
159
ctmpext = strrchr(iconName, '.');
160
167
ctmp2 = g_alloca(PATH_MAX);
161
168
for (i = 0; !myIconName && i < ARRAYSIZE(extraIconPaths); i++) {
162
171
if (!extraIconPaths[i]) {
167
g_snprintf(ctmp2, PATH_MAX, "%s/%s", extraIconPaths[i], iconName);
168
if (g_file_test(ctmp2, G_FILE_TEST_EXISTS)) {
176
* Per Desktop Entry Specification and Icon Theme Specification, I don't
177
* believe that the iconName, unless it's an absolute path, should include
178
* the file extension.
180
* However, empirical evidence shows that -many- applications ignore that
181
* and may specify an icon of, for example, "foo.png". We'll also handle
182
* those special cases here.
184
for (j = 0; !myIconName && j < ARRAYSIZE(iconExtensions); j++) {
185
g_snprintf(ctmp2, PATH_MAX, "%s/%s%s", extraIconPaths[i], iconName,
187
if (!g_file_test(ctmp2, G_FILE_TEST_EXISTS)) {
193
* Case 1: We located an icon by appending an image extension to
196
myIconName = ctmp2; // Will break "i" loop.
170
197
foundItInFile = TRUE;
173
static const char *iconExtensions[] = {
181
for (j = 0; j < ARRAYSIZE(iconExtensions); j++) {
182
g_snprintf(ctmp2, PATH_MAX, "%s/%s%s",
184
iconName, iconExtensions[j]);
185
if (g_file_test(ctmp2, G_FILE_TEST_EXISTS)) {
187
foundItInFile = TRUE;
201
* Case 2: We found an icon without appending an extension. Verify
202
* that the filename contains a valid image extension.
205
char *ctmpext = strrchr(ctmp2, '.');
206
for (k = 1; ctmpext && k < ARRAYSIZE(iconExtensions); k++) {
207
if (strcmp(ctmpext, iconExtensions[k]) == 0) {
208
myIconName = ctmp2; // Will break "i" loop.
209
foundItInFile = TRUE;