comparison cinst/mozilla.c @ 177:c92297bcda8f

dirent d_type is not supported on Windows, so use new port_isdir(). FWIW, according to the man page d_type isn't guarantied to work for all file systems on linux neither.
author Sascha Wilde <wilde@intevation.de>
date Tue, 25 Mar 2014 16:48:18 +0100
parents 6fa0e12ae1d2
children 8fafd0fc2173 344b8a79ad2e
comparison
equal deleted inserted replaced
176:70d627e9e801 177:c92297bcda8f
168 */ 168 */
169 static char ** 169 static char **
170 get_profile_inis () 170 get_profile_inis ()
171 { 171 {
172 char **inis = NULL; 172 char **inis = NULL;
173 #ifndef _WIN32
174 char path[LINEBUFLEN]; 173 char path[LINEBUFLEN];
175 char *fqpath; 174 char *fqpath;
176 DIR *mozdir; 175 DIR *mozdir;
177 struct dirent *mozdirent; 176 struct dirent *mozdirent;
178 177
190 snprintf(path, LINEBUFLEN, "%s/%s", home, "/.mozilla"); 189 snprintf(path, LINEBUFLEN, "%s/%s", home, "/.mozilla");
191 if ((mozdir = opendir(path)) != NULL) 190 if ((mozdir = opendir(path)) != NULL)
192 { 191 {
193 while ((mozdirent = readdir(mozdir)) != NULL) 192 while ((mozdirent = readdir(mozdir)) != NULL)
194 { 193 {
195 if (mozdirent->d_type == DT_DIR) 194 snprintf(path, LINEBUFLEN, "%s/%s/%s",
195 home,
196 "/.mozilla",
197 mozdirent->d_name);
198 if (port_isdir(path))
196 { 199 {
197 snprintf(path, LINEBUFLEN, "%s/%s/%s/%s", 200 snprintf(path, LINEBUFLEN, "%s/%s/%s/%s",
198 home, 201 home,
199 "/.mozilla", 202 "/.mozilla",
200 mozdirent->d_name, 203 mozdirent->d_name,
220 { 223 {
221 /* Windows */ 224 /* Windows */
222 fprintf(stderr, "Windows not yet supported"); 225 fprintf(stderr, "Windows not yet supported");
223 abort(); 226 abort();
224 } 227 }
225 #endif
226 return inis; 228 return inis;
227 } 229 }
228 230
229 231
230 int 232 int

http://wald.intevation.org/projects/trustbridge/