mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 23:03:02 +01:00
Error reporting on failure of invoke_autoruns and solved issue with call to Py_FinalizeEx
This commit is contained in:
parent
02ea0fac44
commit
6d2b90ac9f
12
src/api.c
12
src/api.c
@ -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)
|
void invoke_autoruns(WINDOW *window, ToxWindow *self)
|
||||||
{
|
{
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
char abspath_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 = opendir(user_settings->autorun_path);
|
||||||
FILE *fp;
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cur_window = window;
|
cur_window = window;
|
||||||
self_window = self;
|
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);
|
snprintf(abspath_buf, PATH_MAX + 1, "%s%s", user_settings->autorun_path, dir->d_name);
|
||||||
fp = fopen(abspath_buf, "r");
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
run_python(fp, abspath_buf);
|
run_python(fp, abspath_buf);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -250,7 +250,7 @@ void terminate_python(void)
|
|||||||
free(old);
|
free(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_FinalizeEx();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_python(Tox *m)
|
void init_python(Tox *m)
|
||||||
|
Loading…
Reference in New Issue
Block a user