Add support for specifying --muhome via MU_HOME in the environment
When you have multiple mu home directories, e.g. for the use case
detailed in my "Changing mu4e-{maildir,mu-home} from a context hook"
post to the mailing list it's quite inconvenient to have to hammer out
"mu --muhome=.. find .." every time you want to run some ad-hoc
command.
This allows me to set up a screen session where I do searches in mu
directory A in some screen panes, and searches in directory B in
others.
I initially called this MU_MUHOME but then I noticed that the perl
plugin has MUP_MU_HOME for analogous functionality, so I'm just
following its example.
The code I'm adding in mu-util.c is just a copy/paste & adjustment of
the same sort of already tested functionality in
mu_util_guess_maildir() just a few lines earlier.
This commit is contained in:
@ -199,9 +199,16 @@ gchar*
|
||||
mu_util_guess_mu_homedir (void)
|
||||
{
|
||||
const char* home;
|
||||
const gchar *hdir1;
|
||||
|
||||
/* g_get_home_dir use /etc/passwd, not $HOME; this is better,
|
||||
* as HOME may be wrong when using 'sudo' etc.*/
|
||||
/* first, try MU_HOME */
|
||||
hdir1 = g_getenv ("MU_HOME");
|
||||
|
||||
if (hdir1 && mu_util_check_dir (hdir1, TRUE, FALSE))
|
||||
return g_strdup (hdir1);
|
||||
|
||||
/* then, g_get_home_dir use /etc/passwd, not $HOME; this is
|
||||
* better, as HOME may be wrong when using 'sudo' etc.*/
|
||||
home = g_get_home_dir ();
|
||||
|
||||
if (!home) {
|
||||
|
||||
Reference in New Issue
Block a user