[PATCH v2 2/4] util: Rewrite virGetUserConfigDirectory() using g_get_user_config_dir()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 src/util/virutil.c | 35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index 8c255abd7f..63680974b8 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -586,6 +586,12 @@ virGetUserDirectory(void)
 }
 
 
+char *virGetUserConfigDirectory(void)
+{
+    return g_strdup_printf("%s/libvirt", g_get_user_config_dir());
+}
+
+
 #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 +760,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 +1188,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 +1228,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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux