Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- src/util/virutil.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 70a05e3c9b..6fae3e8288 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -592,6 +592,17 @@ virGetUserDirectory(void) } +char *virGetUserConfigDirectory(void) +{ + const char *configdir = g_get_user_config_dir(); + + if (!configdir) + return NULL; + + return g_strdup_printf("%s/libvirt", configdir); +} + + #ifdef HAVE_GETPWUID_R /* Look up fields from the user database for the given user. On * error, set errno, report the error if not instructed otherwise via @quiet, @@ -760,11 +771,6 @@ static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdefdir) return ret; } -char *virGetUserConfigDirectory(void) -{ - return virGetXDGDirectory("XDG_CONFIG_HOME", ".config"); -} - char *virGetUserCacheDirectory(void) { return virGetXDGDirectory("XDG_CACHE_HOME", ".cache"); @@ -1193,21 +1199,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } -char * -virGetUserConfigDirectory(void) -{ - char *ret; - if (virGetWin32SpecialFolder(CSIDL_LOCAL_APPDATA, &ret) < 0) - return NULL; - - if (!ret) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine config directory")); - return NULL; - } - return ret; -} - char * virGetUserCacheDirectory(void) { @@ -1248,15 +1239,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } -char * -virGetUserConfigDirectory(void) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virGetUserConfigDirectory is not available")); - - return NULL; -} - char * virGetUserCacheDirectory(void) { -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list