[Gpg4win-commits] r727 - in trunk: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 27 13:54:00 CET 2008


Author: marcus
Date: 2008-02-27 13:53:59 +0100 (Wed, 27 Feb 2008)
New Revision: 727

Modified:
   trunk/ChangeLog
   trunk/src/kleowrap.c
Log:
2008-02-27  Marcus Brinkmann  <marcus at g10code.de>

	* src/kleowrap.c: Include errno.h.
	(run_kbuildsycoca): New function by Frank Osterfeld.
	(main): Invoke it.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-02-27 11:19:46 UTC (rev 726)
+++ trunk/ChangeLog	2008-02-27 12:53:59 UTC (rev 727)
@@ -1,5 +1,9 @@
 2008-02-27  Marcus Brinkmann  <marcus at g10code.de>
 
+	* src/kleowrap.c: Include errno.h.
+	(run_kbuildsycoca): New function by Frank Osterfeld.
+	(main): Invoke it.
+
 	* src/inst-kleopatra.nsi, src/uninst-kleopatra.nsi: Move plugins
 	to INSTDIR.
 	* src/inst-kdelibs.nsi, src/uninst-kdelibs.nsi: Likewise.

Modified: trunk/src/kleowrap.c
===================================================================
--- trunk/src/kleowrap.c	2008-02-27 11:19:46 UTC (rev 726)
+++ trunk/src/kleowrap.c	2008-02-27 12:53:59 UTC (rev 727)
@@ -1,5 +1,5 @@
 /* kleopatrawrap.c - Wrapper to call gpg udner Windows.
- * Copyright (C) 2007 g10 Code GmbH
+ * Copyright (C) 2007, 2008 g10 Code GmbH
  *
  * This file is part of Gpg4win.
  *
@@ -27,8 +27,33 @@
 #include <string.h>
 #include <process.h>
 #include <windows.h>
+#include <errno.h>
 
 
+/* Assumes that the current working directory is the Gpg4win INSTDIR
+   installation directory.  */
+int
+run_kbuildsycoca (void)
+{
+  int rc;
+
+  if (! SetEnvironmentVariable ("XDG_DATA_DIRS", "share")
+      || ! SetEnvironmentVariable ("XDG_CONFIG_DIRS", "etc\\xdg"))
+    {
+      fprintf (stderr, "Executing kbuildsycoca4.exe failed: "
+	       "Could not set XDG environment variables\n");
+      return -1;
+    }
+  errno = 0;
+  rc = _spawnl (_P_WAIT, "kbuildsycoca4", "kbuildsycoca4", NULL);
+  if (rc)
+    fprintf (stderr, "Executing kbuildsycoca4.exe failed: %s\n",
+	     strerror (errno));
+
+  return rc;
+}
+
+
 /* Return a copy of ARGV, but with proper quoting.  To release the
    copy, you have to free argv_quoted[0] and argv_quoted.  */
 static char **
@@ -139,9 +164,15 @@
     }
 
   argv_quoted = build_commandline (argv);
-  if (!argv_quoted)
+  if (! argv_quoted)
     goto leave;
 
+  /* Now that the current working is INSTDIR, try to run kbuildsycoca
+     (create/update plugin cache).  We don't check the return value,
+     as kbuildsycoca is allowed to fail (and will if kleopatra is
+     already running).  */
+  run_kbuildsycoca();
+
   /* Using execv does not replace the existing program image, but
      spawns a new one and daemonizes it, confusing the command line
      interpreter.  So we have to use spawnv.  */



More information about the Gpg4win-commits mailing list