* mu-config: properly expand the dirs in mu find (--linksdir) and extract (--targetdir)

This commit is contained in:
djcb 2012-09-16 13:15:44 +03:00
parent 2a0858b349
commit dcb64c02a6
1 changed files with 25 additions and 11 deletions

View File

@ -117,21 +117,26 @@ config_options_group_mu (void)
return og;
}
#define expand_dir(D) \
if ((D)) { \
char *exp; \
exp = mu_util_dir_expand((D)); \
if (exp) { \
g_free((D)); \
(D) = exp; \
} \
}
static void
set_group_index_defaults (void)
{
char *exp;
if (!MU_CONFIG.maildir)
MU_CONFIG.maildir = mu_util_guess_maildir ();
if (MU_CONFIG.maildir) {
exp = mu_util_dir_expand(MU_CONFIG.maildir);
if (exp) {
g_free(MU_CONFIG.maildir);
MU_CONFIG.maildir = exp;
}
}
expand_dir (MU_CONFIG.maildir);
}
static GOptionGroup*
@ -183,6 +188,8 @@ set_group_find_defaults (void)
else
MU_CONFIG.format =
get_output_format (MU_CONFIG.formatstr);
expand_dir (MU_CONFIG.linksdir);
}
static GOptionGroup*
@ -338,6 +345,14 @@ config_options_group_view (void)
static void
set_group_extract_defaults (void)
{
expand_dir (MU_CONFIG.targetdir);
}
static GOptionGroup*
config_options_group_extract (void)
{
@ -620,6 +635,7 @@ mu_config_init (int *argcp, char ***argvp)
set_group_find_defaults();
set_group_cfind_defaults();
set_group_view_defaults();
set_group_extract_defaults();
/* set_group_mkdir_defaults (config); */
return &MU_CONFIG;
@ -659,8 +675,6 @@ mu_config_param_num (MuConfig *opts)
}
MuMsgOptions
mu_config_get_msg_options (MuConfig *muopts)
{