Mercurial > trustbridge
changeset 197:5d380b662198
Search for thunderbird profiles, too.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 26 Mar 2014 12:37:19 +0100 |
parents | 642d81594665 |
children | 56ae02b4a0fc |
files | cinst/mozilla.c |
diffstat | 1 files changed, 34 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/cinst/mozilla.c Wed Mar 26 12:18:12 2014 +0100 +++ b/cinst/mozilla.c Wed Mar 26 12:37:19 2014 +0100 @@ -61,8 +61,10 @@ #include <strhelp.h> #ifndef _WIN32 +#define CONFDIRS ".mozilla", ".thunderbird" #define LINUX 1 #else +#define CONFDIRS "Mozilla", "Thunderbird" #define LINUX 0 #endif @@ -198,53 +200,51 @@ char **inis = NULL; char path[LINEBUFLEN]; char *fqpath; - char *mozdirname; DIR *mozdir; struct dirent *mozdirent; char *confbase = get_conf_basedir(); + const char *confdirs[] = { CONFDIRS, NULL }; - if (LINUX) - { - mozdirname = ".mozilla"; - } - else + for (int i=0; confdirs[i] != NULL; i++) { - mozdirname = "Mozilla"; - } - - snprintf(path, LINEBUFLEN, "%s/%s", - confbase, - mozdirname); - if ((mozdir = opendir(path)) != NULL) - { - while ((mozdirent = readdir(mozdir)) != NULL) + snprintf(path, LINEBUFLEN, "%s/%s", + confbase, + confdirs[i]); + if ((mozdir = opendir(path)) != NULL) { - snprintf(path, LINEBUFLEN, "%s/%s/%s", - confbase, - mozdirname, - mozdirent->d_name); - if (port_isdir(path) - && (strcmp(mozdirent->d_name, "..") != 0)) + while ((mozdirent = readdir(mozdir)) != NULL) { - snprintf(path, LINEBUFLEN, "%s/%s/%s/%s", + snprintf(path, LINEBUFLEN, "%s/%s/%s", confbase, - mozdirname, - mozdirent->d_name, - "profiles.ini"); - DEBUGFPRINT("DEBUG: checking for %s...\n", path); - if ((fqpath = port_realpath(path)) != NULL) + confdirs[i], + mozdirent->d_name); + if (port_isdir(path) + && (strcmp(mozdirent->d_name, "..") != 0)) { - strv_append(&inis, fqpath, strlen(fqpath)); - DEBUGFPRINT("DEBUG: Found mozilla ini file: '%s'\n", fqpath); - free(fqpath); + snprintf(path, LINEBUFLEN, "%s/%s/%s/%s", + confbase, + confdirs[i], + mozdirent->d_name, + "profiles.ini"); + DEBUGFPRINT("DEBUG: checking for %s...\n", path); + if ((fqpath = port_realpath(path)) != NULL) + { + strv_append(&inis, fqpath, strlen(fqpath)); + DEBUGFPRINT("DEBUG: Found mozilla ini file: '%s'\n", fqpath); + free(fqpath); + } } } + closedir(mozdir); } - closedir(mozdir); + else + { + DEBUGFPRINT("DEBUG: Could not open %s/%s\n", confbase, confdirs[i]); + } } - else + if (inis == NULL) { - DEBUGFPRINT("DEBUG: Could not open %s/%s\n", confbase, mozdirname); + DEBUGFPRINT("DEBUG: No ini files found - will do nothing!\n"); exit(WARN_MOZ_NO_PROFILES); } return inis; @@ -264,6 +264,7 @@ get_profile_dirs(mozinis[y++]); if (pdirs != NULL) { + x = 0; while (pdirs[x] != NULL) puts(pdirs[x++]); strv_free(pdirs);