mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
core: create .conf file with default options only if the file does not exist (and not on read error with existing file)
This commit is contained in:
@@ -11,6 +11,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 0.4.3 (under dev)
|
||||
|
||||
* core: create .conf file with default options only if the file does not exist
|
||||
(and not on read error with existing file)
|
||||
* core: fix highlight on action messages: skip the nick at beginning to prevent
|
||||
highlight on it (bug #40516)
|
||||
* core: add default keys `meta2-1;3H` / `meta2-1;3F` (alt+home/end) and
|
||||
|
||||
+14
-12
@@ -2199,26 +2199,28 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
|
||||
|
||||
/* build filename */
|
||||
filename_length = strlen (weechat_home) + strlen (config_file->filename) + 2;
|
||||
filename_length = strlen (weechat_home) + strlen (DIR_SEPARATOR) +
|
||||
strlen (config_file->filename) + 1;
|
||||
filename = malloc (filename_length);
|
||||
if (!filename)
|
||||
return WEECHAT_CONFIG_READ_MEMORY_ERROR;
|
||||
snprintf (filename, filename_length, "%s%s%s",
|
||||
weechat_home, DIR_SEPARATOR, config_file->filename);
|
||||
|
||||
/* create file with default options if it does not exist */
|
||||
if (access (filename, F_OK) != 0)
|
||||
config_file_write_internal (config_file, 1);
|
||||
|
||||
/* read config file */
|
||||
config_file->file = fopen (filename, "r");
|
||||
if (!config_file->file)
|
||||
{
|
||||
config_file_write_internal (config_file, 1);
|
||||
config_file->file = fopen (filename, "r");
|
||||
if (!config_file->file)
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sWarning: configuration file \"%s\" not found"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename);
|
||||
free (filename);
|
||||
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
|
||||
}
|
||||
gui_chat_printf (NULL,
|
||||
_("%sWarning: configuration file \"%s\" not found"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename);
|
||||
free (filename);
|
||||
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!reload)
|
||||
|
||||
Reference in New Issue
Block a user