diff --git a/lib/wp/state.c b/lib/wp/state.c index eed43a26..8415d48a 100644 --- a/lib/wp/state.c +++ b/lib/wp/state.c @@ -8,13 +8,12 @@ #define G_LOG_DOMAIN "wp-state" -#define WP_STATE_DIR_NAME "wireplumber" - #include #include #include "log.h" #include "state.h" +#include "wp.h" #define ESCAPED_CHARACTER '\\' @@ -142,11 +141,7 @@ G_DEFINE_TYPE (WpState, wp_state, G_TYPE_OBJECT) static char * get_new_location (const char *name) { - g_autofree gchar *path = NULL; - - /* Get the config path */ - path = g_build_filename (g_get_user_config_dir (), WP_STATE_DIR_NAME, NULL); - g_return_val_if_fail (path, NULL); + const gchar *path = wp_get_xdg_state_dir (); /* Create the directory if it doesn't exist */ if (g_mkdir_with_parents (path, 0700) < 0) diff --git a/tests/meson.build b/tests/meson.build index d16fc663..0e32f1ff 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -34,6 +34,7 @@ common_test_env = environment({ 'XDG_RUNTIME_DIR': '/invalid', 'PIPEWIRE_RUNTIME_DIR': '/tmp', 'XDG_CONFIG_HOME': meson.current_build_dir() / '.config', + 'XDG_STATE_HOME': meson.current_build_dir() / '.local' / '.state', 'WIREPLUMBER_CONFIG_DIR': '/invalid', 'WIREPLUMBER_DATA_DIR': '/invalid', 'WIREPLUMBER_MODULE_DIR': meson.current_build_dir() / '..' / 'modules',