FEM: Read materials from user settings directory

That commit also adds python function getUserAppDataDir that calls
Application::getUserAppDataDir()

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt
2015-04-08 16:55:20 +01:00
committed by wmayer
parent 21ee31afb5
commit 4232ab88d8
3 changed files with 22 additions and 0 deletions

View File

@@ -80,6 +80,8 @@ PyMethodDef Application::Methods[] = {
"Get the name of the module that can export the filetype"},
{"getResourceDir", (PyCFunction) Application::sGetResourceDir ,1,
"Get the root directory of all resources"},
{"getUserAppDataDir", (PyCFunction) Application::sGetUserAppDataDir ,1,
"Get the root directory of user settings"},
{"getHomePath", (PyCFunction) Application::sGetHomePath ,1,
"Get the home path, i.e. the parent directory of the executable"},
@@ -525,6 +527,15 @@ PyObject* Application::sGetResourceDir(PyObject * /*self*/, PyObject *args,PyObj
return Py::new_reference_to(datadir);
}
PyObject* Application::sGetUserAppDataDir(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Py::String user_data_dir(Application::getUserAppDataDir(),"utf-8");
return Py::new_reference_to(user_data_dir);
}
PyObject* Application::sGetHomePath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C