summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-28 20:19:45 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-28 20:19:45 +0200
commitf87347d44f3f2130dca76667e92430e7e1a0b53d (patch)
tree7cd55eb7e41e22482fa86b50ed408aa164b0fee3
parent96ff7248ef334fa3da138090e5a0cb08d5fae360 (diff)
downloadweechat-f87347d44f3f2130dca76667e92430e7e1a0b53d.zip
core: fix `/upgrade` from previous releases (issue #2106)
When 4 directories are received, the state directory is initialized with the data directory. This fixes the following error on `/upgrade`: Error: wrong number of paths for home directories (expected: 1 or 5, received: 4)
-rw-r--r--src/core/core-dir.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/core-dir.c b/src/core/core-dir.c
index af6d4e4bd..353f85579 100644
--- a/src/core/core-dir.c
+++ b/src/core/core-dir.c
@@ -336,6 +336,16 @@ dir_set_home_path (char *path)
weechat_cache_dir = string_expand_home (paths[0]);
weechat_runtime_dir = string_expand_home (paths[0]);
}
+ else if (num_paths == 4)
+ {
+ /* compatibility with versions between 3.2 and 4.2.x */
+ weechat_config_dir = string_expand_home (paths[0]);
+ weechat_data_dir = string_expand_home (paths[1]);
+ /* state dir = data dir by default */
+ weechat_state_dir = string_expand_home (paths[1]);
+ weechat_cache_dir = string_expand_home (paths[2]);
+ weechat_runtime_dir = string_expand_home (paths[3]);
+ }
else if (num_paths == 5)
{
weechat_config_dir = string_expand_home (paths[0]);
@@ -346,6 +356,10 @@ dir_set_home_path (char *path)
}
else
{
+ /*
+ * value of 4 is not mentioned in the message because it's kept only
+ * for compatibility with old releases, it should not be used any more
+ */
string_fprintf (stderr,
_("Error: wrong number of paths for home directories "
"(expected: 1 or 5, received: %d)\n"),