Skip to content

Commit

Permalink
core: fix /upgrade from previous releases (issue #2106)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
flashcode committed Apr 28, 2024
1 parent 96ff724 commit f87347d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/core-dir.c
Expand Up @@ -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]);
Expand All @@ -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"),
Expand Down

0 comments on commit f87347d

Please sign in to comment.