mirror of
https://github.com/irssi/irssi.git
synced 2026-08-21 17:42:49 +02:00
xdg: fix bug when specifying home directory
When specifying home-dir using --home would skip the part where irssi_cache_dir & irssi_runtime_dir to be uninitialized. Fix that by correctly assigning the variables in question, when irssi_dir == NULL.
This commit is contained in:
parent
059c2a04ea
commit
a554e624ff
2 changed files with 9 additions and 4 deletions
|
|
@ -234,10 +234,15 @@ void core_preinit(const char *path)
|
||||||
len = strlen(irssi_dir);
|
len = strlen(irssi_dir);
|
||||||
if (irssi_dir[len - 1] == G_DIR_SEPARATOR)
|
if (irssi_dir[len - 1] == G_DIR_SEPARATOR)
|
||||||
irssi_dir[len - 1] = '\0';
|
irssi_dir[len - 1] = '\0';
|
||||||
|
/* all special XDG paths are equal to irssi_dir if XDG is not
|
||||||
|
* supported */
|
||||||
|
irssi_cache_dir = irssi_dir;
|
||||||
|
irssi_runtime_dir = irssi_dir;
|
||||||
}
|
}
|
||||||
if (irssi_config_file == NULL)
|
if (irssi_config_file == NULL)
|
||||||
irssi_config_file = use_xdg ? g_build_filename(g_get_user_config_dir(), "irssi", IRSSI_HOME_CONFIG, NULL) :
|
irssi_config_file = use_xdg ? g_build_filename(g_get_user_config_dir(), "irssi",
|
||||||
g_strdup_printf("%s/" IRSSI_HOME_CONFIG, irssi_dir);
|
IRSSI_HOME_CONFIG, NULL) :
|
||||||
|
g_strdup_printf("%s/" IRSSI_HOME_CONFIG, irssi_dir);
|
||||||
else {
|
else {
|
||||||
str = irssi_config_file;
|
str = irssi_config_file;
|
||||||
irssi_config_file = fix_path(str);
|
irssi_config_file = fix_path(str);
|
||||||
|
|
|
||||||
|
|
@ -783,8 +783,8 @@ static void init_configfile(void)
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
init_ensure_dir(get_irssi_dir(), 0700); /* XDG_DATA_HOME or ~/.irssi*/
|
init_ensure_dir(get_irssi_dir(), 0700); /* XDG_DATA_HOME or ~/.irssi*/
|
||||||
if (get_irssi_dir() != get_irssi_cache_dir() &&
|
if (!strcmp(get_irssi_dir(), get_irssi_cache_dir()) &&
|
||||||
get_irssi_dir() != get_irssi_runtime_dir()) {
|
!strcmp(get_irssi_dir(), get_irssi_runtime_dir())) {
|
||||||
init_ensure_dir(get_irssi_cache_dir(), 0700); /* XDG_CACHE_HOME */
|
init_ensure_dir(get_irssi_cache_dir(), 0700); /* XDG_CACHE_HOME */
|
||||||
init_ensure_dir(get_irssi_runtime_dir(), 0700); /* XDG_RUNTIME_HOME */
|
init_ensure_dir(get_irssi_runtime_dir(), 0700); /* XDG_RUNTIME_HOME */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue