add support for cache directory

make configs use specific directory variables instead of just base_dir
so that one configuration can be used for fhs and legacy installations
This commit is contained in:
Russell Treleaven
2014-08-31 20:22:08 -04:00
parent acb439ca03
commit ce96d95c5e
23 changed files with 101 additions and 40 deletions

View File

@@ -478,6 +478,7 @@ static const char usage[] =
"\t-certs [directory] -- alternate directory for certificates\n"
"\t-recordings [directory] -- alternate directory for recordings\n"
"\t-storage [directory] -- alternate directory for voicemail storage\n"
"\t-cache [directory] -- alternate directory for cache files\n"
"\t-sounds [directory] -- alternate directory for sound files\n";
@@ -929,6 +930,21 @@ int main(int argc, char *argv[])
strcpy(SWITCH_GLOBAL_dirs.storage_dir, local_argv[x]);
}
else if (!strcmp(local_argv[x], "-cache")) {
x++;
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
fprintf(stderr, "When using -cache you must specify a cache directory\n");
return 255;
}
SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(strlen(local_argv[x]) + 1);
if (!SWITCH_GLOBAL_dirs.cache_dir) {
fprintf(stderr, "Allocation error\n");
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.cache_dir, local_argv[x]);
}
else if (!strcmp(local_argv[x], "-recordings")) {
x++;
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {