lib: add a function to return the XDG_CONFIG_DIR

This commit is contained in:
Peter Hutterer
2021-07-07 15:17:03 +10:00
committed by George Kiagiadakis
parent 6c3a8d2f83
commit 2e88a115d1
2 changed files with 19 additions and 0 deletions

View File

@@ -97,6 +97,22 @@ wp_get_xdg_state_dir (void)
return xdg_dir;
}
/*!
* \brief Gets the full path to the Wireplumber XDG_CONFIG_DIR subdirectory
* \returns The XDG_CONFIG_DIR subdirectory
*/
const gchar *
wp_get_xdg_config_dir (void)
{
static gchar xdg_dir[PATH_MAX] = {0};
if (xdg_dir[0] == '\0') {
g_autofree gchar *path = g_build_filename (g_get_user_config_dir (),
"wireplumber", NULL);
g_strlcpy (xdg_dir, path, sizeof (xdg_dir));
}
return xdg_dir;
}
/*!
* \brief Gets the Wireplumber configuration directory
* \returns The Wireplumber configuration directory

View File

@@ -68,6 +68,9 @@ const gchar * wp_get_module_dir (void);
WP_API
const gchar * wp_get_xdg_state_dir (void);
WP_API
const gchar * wp_get_xdg_config_dir (void);
WP_API
const gchar * wp_get_config_dir (void);