1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 03:33:25 +01:00

Error reporting on failure of invoke_autoruns and solved issue with call to Py_FinalizeEx

This commit is contained in:
jakob 2017-05-18 21:37:28 -04:00
parent 02ea0fac44
commit 6d2b90ac9f
2 changed files with 10 additions and 4 deletions

View File

@ -160,13 +160,16 @@ void cmd_run(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
void invoke_autoruns(WINDOW *window, ToxWindow *self)
{
struct dirent *dir;
char abspath_buf[PATH_MAX + 1];
char abspath_buf[PATH_MAX + 1], err_buf[PATH_MAX + 1];
size_t path_len;
DIR *d = opendir(user_settings->autorun_path);
FILE *fp;
if (d == NULL)
if (d == NULL) {
snprintf(err_buf, PATH_MAX + 1, "Autorun path does not exist: %s", user_settings->autorun_path);
api_display(err_buf);
return;
}
cur_window = window;
self_window = self;
@ -178,8 +181,11 @@ void invoke_autoruns(WINDOW *window, ToxWindow *self)
snprintf(abspath_buf, PATH_MAX + 1, "%s%s", user_settings->autorun_path, dir->d_name);
fp = fopen(abspath_buf, "r");
if (fp == NULL)
if (fp == NULL) {
snprintf(err_buf, PATH_MAX + 1, "Invalid path: %s", abspath_buf);
api_display(err_buf);
continue;
}
run_python(fp, abspath_buf);
fclose(fp);

View File

@ -250,7 +250,7 @@ void terminate_python(void)
free(old);
}
Py_FinalizeEx();
Py_Finalize();
}
void init_python(Tox *m)