Mod: issue #6274: Source code installation failed
This commit is contained in:
@@ -24,6 +24,7 @@ macro(ConfigureCMakeVariables)
|
||||
|
||||
# used as compiler defines
|
||||
set(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
|
||||
set(LIBRARYDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(DOCDIR "${CMAKE_INSTALL_DOCDIR}")
|
||||
|
||||
message(STATUS "prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
@@ -1139,6 +1139,16 @@ std::string Application::getResourceDir()
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string Application::getLibraryDir()
|
||||
{
|
||||
#ifdef LIBRARYDIR
|
||||
std::string path(LIBRARYDIR);
|
||||
return mConfig["AppHomePath"] + path;
|
||||
#else
|
||||
return mConfig["AppHomePath"] + "lib";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string Application::getHelpDir()
|
||||
{
|
||||
#ifdef DOCDIR
|
||||
|
||||
@@ -410,6 +410,7 @@ public:
|
||||
static std::string getUserAppDataDir();
|
||||
static std::string getUserMacroDir();
|
||||
static std::string getResourceDir();
|
||||
static std::string getLibraryDir();
|
||||
static std::string getHelpDir();
|
||||
//@}
|
||||
|
||||
@@ -519,6 +520,7 @@ private:
|
||||
static PyObject* sChangeExportModule(PyObject *self,PyObject *args);
|
||||
static PyObject* sGetExportType (PyObject *self,PyObject *args);
|
||||
static PyObject* sGetResourcePath (PyObject *self,PyObject *args);
|
||||
static PyObject* sGetLibraryPath (PyObject *self,PyObject *args);
|
||||
static PyObject* sGetTempPath (PyObject *self,PyObject *args);
|
||||
static PyObject* sGetUserCachePath (PyObject *self,PyObject *args);
|
||||
static PyObject* sGetUserConfigPath (PyObject *self,PyObject *args);
|
||||
|
||||
@@ -78,6 +78,8 @@ PyMethodDef Application::Methods[] = {
|
||||
"Get the name of the module that can export the filetype"},
|
||||
{"getResourceDir", (PyCFunction) Application::sGetResourcePath, METH_VARARGS,
|
||||
"Get the root directory of all resources"},
|
||||
{"getLibraryDir", (PyCFunction) Application::sGetLibraryPath, METH_VARARGS,
|
||||
"Get the directory of all extension modules"},
|
||||
{"getTempPath", (PyCFunction) Application::sGetTempPath, METH_VARARGS,
|
||||
"Get the root directory of cached files"},
|
||||
{"getUserCachePath", (PyCFunction) Application::sGetUserCachePath, METH_VARARGS,
|
||||
@@ -647,6 +649,15 @@ PyObject* Application::sGetResourcePath(PyObject * /*self*/, PyObject *args)
|
||||
return Py::new_reference_to(datadir);
|
||||
}
|
||||
|
||||
PyObject* Application::sGetLibraryPath(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
Py::String datadir(Application::getLibraryDir(),"utf-8");
|
||||
return Py::new_reference_to(datadir);
|
||||
}
|
||||
|
||||
PyObject* Application::sGetTempPath(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
|
||||
@@ -12,6 +12,10 @@ IF(RESOURCEDIR)
|
||||
add_definitions(-DRESOURCEDIR="${RESOURCEDIR}")
|
||||
ENDIF(RESOURCEDIR)
|
||||
|
||||
IF(LIBRARYDIR)
|
||||
add_definitions(-DLIBRARYDIR="${LIBRARYDIR}")
|
||||
ENDIF(LIBRARYDIR)
|
||||
|
||||
IF(DOCDIR)
|
||||
add_definitions(-DDOCDIR="${DOCDIR}")
|
||||
ENDIF(DOCDIR)
|
||||
|
||||
@@ -104,6 +104,10 @@ def InitApplications():
|
||||
LibPyDir = os.path.realpath(LibPyDir)
|
||||
if (os.path.exists(LibPyDir)):
|
||||
libpaths.append(LibPyDir)
|
||||
LibFcDir = FreeCAD.getLibraryDir()
|
||||
LibFcDir = os.path.realpath(LibFcDir)
|
||||
if (os.path.exists(LibFcDir) and not LibFcDir in libpaths):
|
||||
libpaths.append(LibFcDir)
|
||||
AddPath = FreeCAD.ConfigGet("AdditionalModulePaths").split(";")
|
||||
HomeMod = FreeCAD.getUserAppDataDir()+"Mod"
|
||||
HomeMod = os.path.realpath(HomeMod)
|
||||
|
||||
Reference in New Issue
Block a user