Expose getUserMacroDir to python and use in preferences.

This commit is contained in:
Markus Lampert
2018-01-07 20:16:49 -08:00
parent 2c69b79c15
commit d13d0bddff
3 changed files with 13 additions and 1 deletions

View File

@@ -85,6 +85,8 @@ PyMethodDef Application::Methods[] = {
"Get the root directory of all resources"},
{"getUserAppDataDir", (PyCFunction) Application::sGetUserAppDataDir ,1,
"Get the root directory of user settings"},
{"getUserMacroDir", (PyCFunction) Application::sGetUserMacroDir ,1,
"Get the directory of the user's macro directory"},
{"getHomePath", (PyCFunction) Application::sGetHomePath ,1,
"Get the home path, i.e. the parent directory of the executable"},
@@ -582,6 +584,15 @@ PyObject* Application::sGetUserAppDataDir(PyObject * /*self*/, PyObject *args,Py
return Py::new_reference_to(user_data_dir);
}
PyObject* Application::sGetUserMacroDir(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Py::String user_macro_dir(Application::getUserMacroDir(),"utf-8");
return Py::new_reference_to(user_macro_dir);
}
PyObject* Application::sGetHomePath(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C