diff options
author | Werner Koch <wk@gnupg.org> | 2008-06-16 15:55:01 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-06-16 15:55:01 +0200 |
commit | 8e37ee4099a33115a21205b1348aaf3fda0ce8ac (patch) | |
tree | 7ce3c416b3b2643bf0461750d5b2c77a93714ea2 /common/homedir.c | |
parent | 2008-06-13 Marcus Brinkmann <marcus@ulysses.g10code.com> (diff) | |
download | gnupg2-8e37ee4099a33115a21205b1348aaf3fda0ce8ac.tar.xz gnupg2-8e37ee4099a33115a21205b1348aaf3fda0ce8ac.zip |
[W32] Change location of /etc.
Diffstat (limited to 'common/homedir.c')
-rw-r--r-- | common/homedir.c | 31 |
1 files changed, 30 insertions, 1 deletions
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); |