Re: Relative directories for database-mail_root and -path?

Subject: Re: Relative directories for database-mail_root and -path?

Date: Sat, 26 Oct 2024 10:53:33 +0800

To: Ralph Seichter, notmuch@notmuchmail.org

Cc:

From: Pengji Zhang


"Ralph Seichter" <ralph@ml.seichter.de> writes:

> Looking at [1], I am trying to figure out if/how the semantic
> equivalent of the pseudo configuration
>
> 	[database]
> 	mail_root = ~/.maildir
> 	path = ~/.local/share/notmuch/default
>
> can be achieved? The docs don't mention that '~' has any special
> meaning, and my tests agree. How then does one specify directories
> relative to the user's $HOME ? Simply dropping the ~/ prefix and using
> .maildir or .local does not seem to work either. I found the latter
> being suggested in some Internet search result or other, and thought
> I'd give it a try, but no dice.

I suppose dropping the prefix should work? In 'lib/config.cc':

--8<---------------cut here---------------start------------->8---
static char *
_expand_path (void *ctx, const char *key, const char *val)
{
    char *expanded_val;

    if ((strcmp (key, "database.path") == 0 ||
	 strcmp (key, "database.mail_root") == 0 ||
	 strcmp (key, "database.hook_dir") == 0 ||
	 strcmp (key, "database.backup_path") == 0 ) &&
	val[0] != '/')
	expanded_val = talloc_asprintf (ctx, "%s/%s", getenv ("HOME"), val);
    else
	expanded_val = talloc_strdup (ctx, val);

    return expanded_val;
}
--8<---------------cut here---------------end--------------->8---

So if the value does not start with '/', it is considered relative to
the home directory.

What does 'notmuch config list' show for you?

Pengji
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: