diff --git a/NEWS b/NEWS index 4d09f4090..efce67dea 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ Noteworthy changes in version 2.0.10 (unreleased) * [W32] Initialized the socket subsystem for all keyserver helpers. + * [W32] The sysconf directory has been moved from a subdirectory of + the installation directory to %CSIDL_COMMON_APPDATA%/GNU/etc/gnupg. + * New gpg2 command --locate-keys. * New gpg2 options --with-sig-list and --with-sig-check. diff --git a/common/ChangeLog b/common/ChangeLog index dbdcbcf50..5bb986f30 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,8 @@ +2008-06-16 Werner Koch + + * homedir.c (w32_commondir): New. + (gnupg_sysconfdir): Use it. + 2008-06-09 Werner Koch * b64dec.c: New. diff --git a/common/homedir.c b/common/homedir.c index eb1e5025a..616565ef0 100644 --- a/common/homedir.c +++ b/common/homedir.c @@ -197,6 +197,35 @@ w32_rootdir (void) /* Fallback to the hardwired value. */ return GNUPG_LIBEXECDIR; } + +static const char * +w32_commondir (void) +{ + static char *dir; + + if (!dir) + { + char path[MAX_PATH]; + + if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA, + NULL, 0, path) >= 0) + { + char *tmp = xmalloc (strlen (path) + 4 +1); + strcpy (stpcpy (tmp, path), "\\GNU"); + dir = tmp; + /* No auto create of the directory. Either the installer or + the admin has to create these directories. */ + } + else + { + /* Ooops: Not defined - probably an old Windows version. + Use the installation directory instead. */ + dir = xstrdup (w32_rootdir ()); + } + } + + return dir; +} #endif /*HAVE_W32_SYSTEM*/ @@ -214,7 +243,7 @@ gnupg_sysconfdir (void) if (!name) { const char *s1, *s2; - s1 = w32_rootdir (); + s1 = w32_commondir (); s2 = DIRSEP_S "etc" DIRSEP_S "gnupg"; name = xmalloc (strlen (s1) + strlen (s2) + 1); strcpy (stpcpy (name, s1), s2);