[svn] dirmngr - r275 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Mon Nov 26 17:28:19 CET 2007
Author: marcus
Date: 2007-11-26 17:28:18 +0100 (Mon, 26 Nov 2007)
New Revision: 275
Modified:
trunk/src/ChangeLog
trunk/src/get-path.c
Log:
2007-11-26 Marcus Brinkmann <marcus at g10code.de>
* get-path.c (dirmngr_cachedir): Create intermediate directories.
(default_socket_name): Use CSIDL_WINDOWS.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-11-14 19:07:43 UTC (rev 274)
+++ trunk/src/ChangeLog 2007-11-26 16:28:18 UTC (rev 275)
@@ -1,3 +1,8 @@
+2007-11-26 Marcus Brinkmann <marcus at g10code.de>
+
+ * get-path.c (dirmngr_cachedir): Create intermediate directories.
+ (default_socket_name): Use CSIDL_WINDOWS.
+
2007-11-14 Werner Koch <wk at g10code.com>
* dirmngr-client.c: Replace --lookup-url by --url.
Modified: trunk/src/get-path.c
===================================================================
--- trunk/src/get-path.c 2007-11-14 19:07:43 UTC (rev 274)
+++ trunk/src/get-path.c 2007-11-26 16:28:18 UTC (rev 275)
@@ -478,18 +478,34 @@
if (!dir)
{
char path[MAX_PATH];
- const char *s1;
-
- s1 = "\\GNU\\cache\\dirmngr";
+ const char *s1[] = { "GNU", "cache", "dirmngr", NULL };
+ int s1_len;
+ char **comp;
+
+ s1_len = 0;
+ for (comp = s1; *comp; comp++)
+ {
+ /* Take account for the separator. */
+ s1_len += 1 + strlen (*comp);
+ }
+
if (w32_shgetfolderpath (NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE,
NULL, 0, path) >= 0)
{
- char *tmp = xmalloc (strlen (path) + strlen (s1) +1);
- strcpy (stpcpy (tmp, path), s1);
+ char *tmp = xmalloc (strlen (path) + s1_len + 1);
+ char *p;
+
+ p = stpcpy (tmp, path);
+ for (comp = s1; *comp; comp++)
+ {
+ p = stpcpy (p, "\\");
+ p = stpcpy (p, *comp);
+
+ if (access (tmp, F_OK))
+ CreateDirectory (tmp, NULL);
+ }
+
dir = tmp;
-
- if (access (dir, F_OK))
- CreateDirectory (dir, NULL);
}
else
dir = "c:\\temp\\cache\\dirmngr";
@@ -509,8 +525,13 @@
if (!name)
{
- const char *s1, *s2;
- s1 = w32_rootdir (); /* FIXME: /var in windows? */
+ char s1[MAX_PATH];
+ const char *s2;
+
+ /* We need something akin CSIDL_COMMON_PROGRAMS, but local
+ (non-roaming). */
+ if (w32_shgetfolderpath (NULL, CSIDL_WINDOWS, NULL, 0, s1) < 0)
+ strcpy (s1, "C:\\WINDOWS");
s2 = DIRSEP_S "S.dirmngr";
name = xmalloc (strlen (s1) + strlen (s2) + 1);
strcpy (stpcpy (name, s1), s2);
More information about the Gnupg-commits
mailing list