From 228d80736c39e41a6b46dad211df0ba871b0c8f8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 2 Mar 2001 05:58:11 +0000 Subject: RISCOS files by dschwertberger --- RISCOS/Modules/getpath_riscos.c | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 RISCOS/Modules/getpath_riscos.c (limited to 'RISCOS/Modules/getpath_riscos.c') diff --git a/RISCOS/Modules/getpath_riscos.c b/RISCOS/Modules/getpath_riscos.c new file mode 100644 index 0000000000..7582b17306 --- /dev/null +++ b/RISCOS/Modules/getpath_riscos.c @@ -0,0 +1,56 @@ +#include "Python.h" +#include "osdefs.h" + +static char *prefix,*exec_prefix,*progpath,*module_search_path=0; + +static void +calculate_path() +{ char *pypath=getenv("Python$Path"); + if(pypath) + { module_search_path=malloc(strlen(pypath)+1); + if (module_search_path) sprintf(module_search_path,"%s",pypath); + else + { /* We can't exit, so print a warning and limp along */ + fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n"); + fprintf(stderr, "Using default static PYTHONPATH.\n"); + } + } + if(!module_search_path) module_search_path = ".Lib"; + prefix=""; + exec_prefix=prefix; + progpath=""; +} + +/* External interface */ + +char * +Py_GetPath() +{ + if (!module_search_path) + calculate_path(); + return module_search_path; +} + +char * +Py_GetPrefix() +{ + if (!module_search_path) + calculate_path(); + return prefix; +} + +char * +Py_GetExecPrefix() +{ + if (!module_search_path) + calculate_path(); + return exec_prefix; +} + +char * +Py_GetProgramFullPath() +{ + if (!module_search_path) + calculate_path(); + return progpath; +} -- cgit v1.2.1