state: store our WpState files in $XDG_STATE_HOME/wireplumber

This commit is contained in:
Peter Hutterer 2021-07-13 15:31:02 +10:00
parent ab62af1748
commit be1a077eaf
2 changed files with 3 additions and 7 deletions

View file

@ -8,13 +8,12 @@
#define G_LOG_DOMAIN "wp-state"
#define WP_STATE_DIR_NAME "wireplumber"
#include <stdio.h>
#include <errno.h>
#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)

View file

@ -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',