diff --git a/src/api.c b/src/api.c index 0b0ce8f..c7ecd36 100644 --- a/src/api.c +++ b/src/api.c @@ -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); diff --git a/src/settings.c b/src/settings.c index 4a00b07..4fe1303 100644 --- a/src/settings.c +++ b/src/settings.c @@ -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) ) {