mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib/open: canonicalize relative path read from config file
This matches functionality in the the CLI function notmuch_config_get_database_path, which was previously used in the CLI code for all calls to open a database.
This commit is contained in:
parent
2e9ee47072
commit
b25e57e6cb
1 changed files with 4 additions and 2 deletions
|
@ -196,11 +196,13 @@ _choose_database_path (void *ctx,
|
|||
if (! *database_path && key_file) {
|
||||
char *path = g_key_file_get_value (key_file, "database", "path", NULL);
|
||||
if (path) {
|
||||
*database_path = talloc_strdup (ctx, path);
|
||||
if (path[0] == '/')
|
||||
*database_path = talloc_strdup (ctx, path);
|
||||
else
|
||||
*database_path = talloc_asprintf (ctx, "%s/%s", getenv ("HOME"), path);
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
if (! *database_path) {
|
||||
*database_path = _xdg_dir (ctx, "XDG_DATA_HOME", ".local/share", profile);
|
||||
*split = true;
|
||||
|
|
Loading…
Reference in a new issue