Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- src/util/virutil.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 7008c3119c..9d98b0051a 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -586,6 +586,16 @@ virGetUserDirectory(void) } +char *virGetUserConfigDirectory(void) +{ +#ifdef WIN32 + return g_strdup(g_get_user_config_dir()); +#else + return g_build_filename(g_get_user_config_dir(), "libvirt", NULL); +#endif +} + + #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, @@ -754,11 +764,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"); @@ -1187,21 +1192,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) { @@ -1242,15 +1232,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