history: Allow overriding history directory for testing

Read UP_HISTORY_DIR for the history directory so that it can be made
writeable during testing.
This commit is contained in:
Benjamin Berg 2022-05-09 21:00:33 +02:00
parent 5fd3c9988c
commit 0a1edd7916

View file

@ -895,7 +895,10 @@ up_history_init (UpHistory *history)
history->priv->data_time_empty = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
history->priv->max_data_age = UP_HISTORY_DEFAULT_MAX_DATA_AGE;
up_history_set_directory (history, HISTORY_DIR);
if (g_getenv ("UPOWER_HISTORY_DIR"))
up_history_set_directory (history, g_getenv ("UPOWER_HISTORY_DIR"));
else
up_history_set_directory (history, HISTORY_DIR);
}
/**