Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
src/util/virutil.c | 53 ++++++----------------------------------------
1 file changed, 6 insertions(+), 47 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 63680974b8..9485316e05 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -592,6 +592,12 @@ char *virGetUserConfigDirectory(void)
}
+char *virGetUserCacheDirectory(void)
+{
+ return g_strdup_printf("%s/libvirt", g_get_user_cache_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,
@@ -742,29 +748,6 @@ char *virGetUserShell(uid_t uid)
}
-static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdefdir)
-{
- const char *path = getenv(xdgenvname);
- char *ret = NULL;
- char *home = NULL;
-
- if (path && path[0]) {
- ret = g_strdup_printf("%s/libvirt", path);
- } else {
- home = virGetUserDirectory();
- if (home)
- ret = g_strdup_printf("%s/%s/libvirt", home, xdgdefdir);
- }
-
- VIR_FREE(home);
- return ret;
-}
-
-char *virGetUserCacheDirectory(void)
-{
- return virGetXDGDirectory("XDG_CACHE_HOME", ".cache");
-}
-
char *virGetUserRuntimeDirectory(void)
{
const char *path = getenv("XDG_RUNTIME_DIR");
@@ -1188,21 +1171,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED)
return NULL;
}
-char *
-virGetUserCacheDirectory(void)
-{
- char *ret;
- if (virGetWin32SpecialFolder(CSIDL_INTERNET_CACHE, &ret) < 0)
- return NULL;
-
- if (!ret) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine config directory"));
- return NULL;
- }
- return ret;
-}
-
char *
virGetUserRuntimeDirectory(void)
{
@@ -1228,15 +1196,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED)
return NULL;
}
-char *
-virGetUserCacheDirectory(void)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserCacheDirectory is not
available"));
-
- return NULL;
-}
-
char *
virGetUserRuntimeDirectory(void)
{
--
2.23.0