Skip to content
Snippets Groups Projects
Commit 171f2856 authored by Point Gerald's avatar Point Gerald
Browse files

do not load default preferences if environment variable ARC_TEST_SUITE=1

parent bed4d643
No related branches found
No related tags found
No related merge requests found
......@@ -174,27 +174,40 @@ arc_save_preferences(void)
}
}
static int
s_execute_test_suite (void)
{
const char *val = getenv ("ARC_TEST_SUITE");
if (val != NULL)
return (strcmp (val, "1") == 0 || strcmp (val, "true") == 0);
return 0;
}
static void
s_set_initial_prefs (ccl_config_table *table)
{
char *datadir = getenv ("ARC_DATADIR");
char *defprefs = ccl_string_format_new ("%s/" ARC_DEFAULT_PREFERENCES,
datadir);
FILE *input = fopen (defprefs, "r");
if (input == NULL)
{
input = fopen (ARC_DATADIR "/" ARC_DEFAULT_PREFERENCES, "r");
if (input == NULL && getenv ("ARC_TEST_SUITE") == NULL)
fprintf (stderr, "can't load default preferences '%s/%s'.\n",
ARC_DATADIR, ARC_DEFAULT_PREFERENCES);
}
if (input != NULL)
if (! s_execute_test_suite ())
{
ccl_config_table_load (ARC_PREFERENCES, input);
fclose (input);
char *datadir = getenv ("ARC_DATADIR");
char *defprefs = ccl_string_format_new ("%s/" ARC_DEFAULT_PREFERENCES,
datadir);
FILE *input = fopen (defprefs, "r");
if (input == NULL)
{
input = fopen (ARC_DATADIR "/" ARC_DEFAULT_PREFERENCES, "r");
if (input == NULL)
fprintf (stderr, "can't load default preferences '%s/%s'.\n",
ARC_DATADIR, ARC_DEFAULT_PREFERENCES);
}
if (input != NULL)
{
ccl_config_table_load (ARC_PREFERENCES, input);
fclose (input);
}
ccl_string_delete (defprefs);
}
ccl_string_delete (defprefs);
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment