1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 13:27:46 +02:00

Fix error messages being printed when autorun_path is unset.

This commit is contained in:
jakob 2017-05-23 19:12:53 -04:00
parent 22ea522baf
commit 369f26932e
2 changed files with 9 additions and 1 deletions

View File

@ -169,9 +169,14 @@ void invoke_autoruns(WINDOW *window, ToxWindow *self)
struct dirent *dir;
char abspath_buf[PATH_MAX + 1], err_buf[PATH_MAX + 1];
size_t path_len;
DIR *d = opendir(user_settings->autorun_path);
DIR *d;
FILE *fp;
if (user_settings->autorun_path[0] == '\0')
return;
d = opendir(user_settings->autorun_path);
if (d == NULL) {
snprintf(err_buf, PATH_MAX + 1, "Autorun path does not exist: %s", user_settings->autorun_path);
api_display(err_buf);

View File

@ -195,6 +195,7 @@ static void tox_defaults(struct user_settings *settings)
strcpy(settings->download_path, "");
strcpy(settings->chatlogs_path, "");
strcpy(settings->avatar_path, "");
strcpy(settings->autorun_path, "");
strcpy(settings->password_eval, "");
}
@ -421,6 +422,7 @@ int settings_load(struct user_settings *s, const char *patharg)
}
#ifdef PYTHON
if ( config_setting_lookup_string(setting, tox_strings.autorun_path, &str) ) {
snprintf(s->autorun_path, sizeof(s->autorun_path), "%s", str);
int len = strlen(str);
@ -430,6 +432,7 @@ int settings_load(struct user_settings *s, const char *patharg)
else if (s->autorun_path[len - 1] != '/')
strcat(&s->autorun_path[len - 1], "/");
}
#endif
if ( config_setting_lookup_string(setting, tox_strings.password_eval, &str) ) {