[W32] Change location of /etc.

This commit is contained in:
Werner Koch 2008-06-16 13:55:01 +00:00
parent 88fdd39749
commit 8e37ee4099
3 changed files with 38 additions and 1 deletions

3
NEWS
View File

@ -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.

View File

@ -1,3 +1,8 @@
2008-06-16 Werner Koch <wk@g10code.com>
* homedir.c (w32_commondir): New.
(gnupg_sysconfdir): Use it.
2008-06-09 Werner Koch <wk@g10code.com>
* b64dec.c: New.

View File

@ -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);