mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-25 22:23:02 +01:00
Fix error messages being printed when autorun_path is unset.
This commit is contained in:
parent
22ea522baf
commit
369f26932e
@ -169,9 +169,14 @@ void invoke_autoruns(WINDOW *window, ToxWindow *self)
|
|||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
char abspath_buf[PATH_MAX + 1], err_buf[PATH_MAX + 1];
|
char abspath_buf[PATH_MAX + 1], err_buf[PATH_MAX + 1];
|
||||||
size_t path_len;
|
size_t path_len;
|
||||||
DIR *d = opendir(user_settings->autorun_path);
|
DIR *d;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
if (user_settings->autorun_path[0] == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
d = opendir(user_settings->autorun_path);
|
||||||
|
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
snprintf(err_buf, PATH_MAX + 1, "Autorun path does not exist: %s", user_settings->autorun_path);
|
snprintf(err_buf, PATH_MAX + 1, "Autorun path does not exist: %s", user_settings->autorun_path);
|
||||||
api_display(err_buf);
|
api_display(err_buf);
|
||||||
|
@ -195,6 +195,7 @@ static void tox_defaults(struct user_settings *settings)
|
|||||||
strcpy(settings->download_path, "");
|
strcpy(settings->download_path, "");
|
||||||
strcpy(settings->chatlogs_path, "");
|
strcpy(settings->chatlogs_path, "");
|
||||||
strcpy(settings->avatar_path, "");
|
strcpy(settings->avatar_path, "");
|
||||||
|
strcpy(settings->autorun_path, "");
|
||||||
strcpy(settings->password_eval, "");
|
strcpy(settings->password_eval, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,6 +422,7 @@ int settings_load(struct user_settings *s, const char *patharg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PYTHON
|
#ifdef PYTHON
|
||||||
|
|
||||||
if ( config_setting_lookup_string(setting, tox_strings.autorun_path, &str) ) {
|
if ( config_setting_lookup_string(setting, tox_strings.autorun_path, &str) ) {
|
||||||
snprintf(s->autorun_path, sizeof(s->autorun_path), "%s", str);
|
snprintf(s->autorun_path, sizeof(s->autorun_path), "%s", str);
|
||||||
int len = strlen(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] != '/')
|
else if (s->autorun_path[len - 1] != '/')
|
||||||
strcat(&s->autorun_path[len - 1], "/");
|
strcat(&s->autorun_path[len - 1], "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( config_setting_lookup_string(setting, tox_strings.password_eval, &str) ) {
|
if ( config_setting_lookup_string(setting, tox_strings.password_eval, &str) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user