Compare commits

..

No commits in common. "a60fe6543edf0f848b7b35fa7e76219ca5e5766b" and "322439145e60e9496352bc5124f52cd1c22422ff" have entirely different histories.

View File

@ -39,6 +39,20 @@
*/ */
static PyObject *p_module = NULL; static PyObject *p_module = NULL;
static int check_file_exists(const char *path)
{
FILE *file;
int ret = -1;
file = fopen(path, "rb");
if (file) {
fclose(file);
ret = 0;
}
return ret;
}
int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale) int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale)
{ {
int ret = 0; int ret = 0;
@ -98,6 +112,11 @@ int FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *ve
PyList_Append(p_sys_path, p_cwd_string); PyList_Append(p_sys_path, p_cwd_string);
Py_DECREF(p_cwd_string); Py_DECREF(p_cwd_string);
/* This renderer has only one parameter: The name of the file */
/*if (check_file_exists(params))
return -1001;
*/
p_name = PyUnicode_DecodeFSDefault(params); p_name = PyUnicode_DecodeFSDefault(params);
p_module = PyImport_Import(p_name); p_module = PyImport_Import(p_name);
Py_DECREF(p_name); Py_DECREF(p_name);
@ -125,5 +144,3 @@ int FUNC_DECL(EXTERNAL_LIBRARY_FINALIZE_FUNCTION)(void)
ret = Py_FinalizeEx(); ret = Py_FinalizeEx();
return ret; return ret;
} }
/** @} */