App: add new config key UserConfigPath to store the path to the config files

This commit is contained in:
wmayer
2021-11-09 13:46:26 +01:00
parent 2cc5707571
commit 5ad8bed9c4
3 changed files with 26 additions and 3 deletions

View File

@@ -88,8 +88,10 @@ PyMethodDef Application::Methods[] = {
"Get the name of the module that can export the filetype"},
{"getResourceDir", (PyCFunction) Application::sGetResourceDir, METH_VARARGS,
"Get the root directory of all resources"},
{"getUserConfigDir", (PyCFunction) Application::sGetUserConfigDir, METH_VARARGS,
"Get the root directory of user config files"},
{"getUserAppDataDir", (PyCFunction) Application::sGetUserAppDataDir, METH_VARARGS,
"Get the root directory of user settings"},
"Get the root directory of application data"},
{"getUserMacroDir", (PyCFunction) Application::sGetUserMacroDir, METH_VARARGS,
"getUserMacroDir(bool=False) -> string"
"Get the directory of the user's macro directory\n"
@@ -651,6 +653,15 @@ PyObject* Application::sGetResourceDir(PyObject * /*self*/, PyObject *args)
return Py::new_reference_to(datadir);
}
PyObject* Application::sGetUserConfigDir(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
Py::String datadir(Application::getUserConfigDir(),"utf-8");
return Py::new_reference_to(datadir);
}
PyObject* Application::sGetUserAppDataDir(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C