* add mu_util_guess_mu_homedir and mu_util_guess_xapian_dir and use them

This commit is contained in:
Dirk-Jan C. Binnema
2010-11-02 21:12:18 +02:00
parent d112c2c930
commit 3b87a0f9e6
3 changed files with 58 additions and 22 deletions

View File

@ -27,32 +27,14 @@
#include "mu-util.h"
#include "mu-config.h"
static gchar*
guess_muhome (void)
{
const char* home;
home = g_getenv ("HOME");
if (!home)
home = g_get_home_dir ();
if (!home)
MU_WRITE_LOG ("failed to determine homedir");
return g_strdup_printf ("%s%c%s", home ? home : ".", G_DIR_SEPARATOR,
".mu");
}
static void
set_group_mu_defaults (MuConfigOptions *opts)
{
if (!opts->muhome)
opts->muhome = guess_muhome ();
if (!opts->muhome)
opts->muhome = mu_util_guess_mu_homedir ();
/* note: xpath is is *not* settable from the cmdline */
opts->xpath = g_strdup_printf ("%s%c%s", opts->muhome,G_DIR_SEPARATOR,
MU_XAPIAN_DIR_NAME);
opts->xpath = mu_util_guess_xapian_dir (opts->muhome);
}