On 05/24/2012 07:44 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add an impl of +virGetUserRuntimeDirectory, virGetUserCacheDirectory
virGetUserConfigDirectory and virGetUserDirectory for Win32 platform.
Also create stubs for non-Win32 platforms which lack getpwuid_r()
In adding these two helpers were added virFileIsAbsPath and
virFileSkipRoot, along with some macros VIR_FILE_DIR_SEPARATOR,
VIR_FILE_DIR_SEPARATOR_S, VIR_FILE_IS_DIR_SEPARATOR,
VIR_FILE_PATH_SEPARATOR, VIR_FILE_PATH_SEPARATOR_S
All this code was adapted from GLib2 under terms of LGPLv2+ license.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt_private.syms | 2 +
src/util/util.c | 253 +++++++++++++++++++++++++++++++++++++++++++++-
src/util/util.h | 24 +++++
3 files changed, 277 insertions(+), 2 deletions(-)
@@ -2305,7 +2381,7 @@ static char *virGetGroupEnt(gid_t gid)
return ret;
}
-char *virGetUserDirectory()
+char *virGetUserDirectory(void)
This particular hunk should be squashed into 1/2.
ACK; the code looked generally reasonable. I note that on WIN32, it
didn't treat 'c:file' as absolute (it's anchored to the C drive, but is
relative to the current directory of that drive, and yes, Windows really
does have 26 current directories, one per drive letter, in addition to
the global current working directory). But while this might mess up
unusual situations, I'm not sure it is worth worrying about, and this
addition is a strict improvement over the previous behavior of no
support at all.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org