diff options
Diffstat (limited to '')
-rw-r--r-- | g10/misc.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c index 70667cf7e..0bf71c264 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1146,3 +1146,36 @@ default_homedir (void) return dir; } + + +/* Return the name of the libexec directory. The name is allocated in + a static area on the first use. This function won't fail. */ +const char * +get_libexecdir (void) +{ +#ifdef HAVE_W32_SYSTEM + static int got_dir; + static char *dir; + + if (!got_dir) + { + dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE", + "Software\\GNU\\GnuPG", + "Install Directory"); + if (dir && !*dir) + { + /* To avoid problems with using an empty dir we don't allow + for that. */ + free (dir); + dir = NULL; + } + got_dir = 1; + } + + if (dir) + return dir; + /* Fallback to the hardwired value. */ +#endif /*HAVE_W32_SYSTEM*/ + + return GNUPG_LIBEXECDIR; +} |