FreeCAD.getHomePath() not correct on Arch linux

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

Now it finally seams that FreeCAD is behaving properly in my Arch installation.

All icons show, no more errors on startup.

I even can remove the Arch specific code from PluginManager. :D

I do not know if these changes would have any negative impact on other platforms.

Please advice on what to do next, to get this fixed.

Base installation from Aur:freecad-git

Changes in FreeCAD:
1.CMakeFiles.txt

Code: Select all

--- /home/kjetil/src/freecad/FreeCAD/CMakeLists.txt
+++ /home/kjetil/src/aurpac/freecad-org/freecad-git/src/freecad/CMakeLists.txt
@@ -92,12 +92,14 @@
 # used as compiler defines
 SET(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
 SET(DOCDIR "${CMAKE_INSTALL_DOCDIR}")
+SET(HOMEDIR "${CMAKE_INSTALL_HOMEDIR}")
 
 MESSAGE(STATUS "prefix: ${CMAKE_INSTALL_PREFIX}")
 MESSAGE(STATUS "datadir: ${CMAKE_INSTALL_DATADIR}")
 MESSAGE(STATUS "docdir: ${CMAKE_INSTALL_DOCDIR}")
 MESSAGE(STATUS "includedir: ${CMAKE_INSTALL_INCLUDEDIR}")
 MESSAGE(STATUS "libdir: ${CMAKE_INSTALL_LIBDIR}")
+MESSAGE(STATUS "homedir: ${CMAKE_INSTALL_HOMEDIR}")
 
 # ==============================================================================
 # == Win32 is default behaviour use the LibPack copied in Source tree ==========
2 App/CMakeLists.txt

Code: Select all

--- /home/kjetil/src/freecad/FreeCAD/src/App/CMakeLists.txt
+++ /home/kjetil/src/aurpac/freecad-org/freecad-git/src/freecad/src/App/CMakeLists.txt
@@ -7,6 +7,10 @@
 IF(RESOURCEDIR)
     add_definitions(-DRESOURCEDIR="${RESOURCEDIR}")
 ENDIF(RESOURCEDIR)
+
+IF(HOMEDIR)
+    add_definitions(-DHOMEDIR="${HOMEDIR}")
+ENDIF(HOMEDIR)
 
 IF(DOCDIR)
     add_definitions(-DDOCDIR="${DOCDIR}")
3 App/Application.cpp

Code: Select all

--- /home/kjetil/src/freecad/FreeCAD/src/App/Application.cpp
+++ /home/kjetil/src/aurpac/freecad-org/freecad-git/src/freecad/src/App/Application.cpp
@@ -531,7 +531,7 @@
     if (dir.isAbsolute())
         return path;
     else
-        return mConfig["AppHomePath"] + path;
+        return mConfig["AppHomePath"];
 #else
     return mConfig["AppHomePath"];
 #endif
@@ -1137,7 +1137,13 @@
 void Application::initConfig(int argc, char ** argv)
 {
     // find the home path....
+#ifdef HOMEDIR
+    std::string path(HOMEDIR);
+    path.append("/");
+    mConfig["AppHomePath"] = path;
+#else
     mConfig["AppHomePath"] = FindHomePath(argv[0]);
+#endif
 
     // Version of the application extracted from SubWCRef into src/Build/Version.h
     // We only set these keys if not yet defined. Therefore it suffices to search
Changes in AUR
1

Code: Select all

--- /home/kjetil/Downloads/PKBUILD
+++ /home/kjetil/src/aurpac/freecad-org/freecad-git/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Christian Hesse <mail@eworm.de>
 
 pkgname=freecad-git
-pkgver=0.16.pre.r3.g192dca3
+pkgver=0.16.pre.r111.g94a62e0
 pkgrel=1
 pkgdesc='A general purpose 3D CAD modeler - git checkout'
 arch=('i686' 'x86_64')
@@ -51,10 +51,12 @@
 		-DCMAKE_INSTALL_DOCDIR:PATH="share/freecad/doc" \
 		-DCMAKE_INSTALL_DATADIR:PATH="share/freecad" \
 		-DCMAKE_INSTALL_LIBDIR:PATH="lib/freecad" \
+		-DCMAKE_INSTALL_HOMEDIR:PATH="/usr/share/freecad/" \
 		-DOCC_INCLUDE_DIR:PATH=/opt/opencascade/inc/ \
 		-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2 \
 		-DPYSIDEUIC4BINARY:FILEPATH=/usr/bin/python2-pyside-uic \
		-DFREECAD_USE_EXTERNAL_PIVY:BOOL=ON


 
 	make
 }
Need help? Feel free to ask, but please read the guidelines first
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by sgrogan »

cox wrote:I do not know if these changes would have any negative impact on other platforms.
@cox
If you can push a branch to github. I can check if this causes a problem on windows or kubuntu 14.04
"fight the good fight"
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

I will try, first time :D
Need help? Feel free to ask, but please read the guidelines first
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by sgrogan »

If you want i can make the changes and push a branch. You should still learn because i don't know how to attribute the changes to you. if testing is good you can then push a branch and make a pull request.
"fight the good fight"
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

sgrogan wrote: If you can push a branch to github. I can check if this causes a problem on windows or kubuntu 14.04
My changes are now here, https://github.com/kkoksvik/FreeCAD/tree/arch01


Thanks a lot for testing :D
Need help? Feel free to ask, but please read the guidelines first
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by sgrogan »

I'm on it.
cox wrote:Thanks a lot for testing :D
As a windows guy in open source "cross-platform" is my favorite phrase :)
"fight the good fight"
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by sgrogan »

I get some Travis-Ci errors. (This is Ubuntu precise)
https://travis-ci.org/sgrogan/FreeCAD
See line 4514
Try changing to Test-framework WB and running self-test form the toolbar.
on win i get this:
arch01.PNG
arch01.PNG (52.14 KiB) Viewed 2084 times
on win I get the same message trying to activate the robot wb after the test.
"fight the good fight"
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

sgrogan wrote:Try changing to Test-framework WB and running self-test form the toolbar.
Self test completes with no errors here.

I will have to do some thinking, I think. :)

Looking around the code, App.getResourceDir() and App.getHomePath() seams to be used inconsistently.
wmayer wrote: FreeCAD was never designed that the sub-directories 'bin', 'doc', 'Mod', ... have different parent directories. There might still be cases where certain things don't work.
Best results for me seams to be when I make FreeCAD in such a way that App.getResourceDir() and App.getHomePath() returns the same folder.

>>> App.getHomePath()
u'/usr/share/freecad/'
>>> App.getResourceDir()
u'/usr/share/freecad/'

My guess is that App.getResourceDir() returns u'/usr/local/̈́' and App.getHomePath() returns u'/usr/local/̈́FreeCAD' on your Kubuntu.


Will check more tomorrow.

Thanks again for testing sgrogan. :D
Need help? Feel free to ask, but please read the guidelines first
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

Updated my branch https://github.com/kkoksvik/FreeCAD/tree/arch01

Tried to limit the influence of my change, on builds not defining CMAKE_INSTALL_HOMEDIR, witch should probably be all but my new arch build.

Please test :)
Need help? Feel free to ask, but please read the guidelines first
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: FreeCAD.getHomePath() not correct on Arch linux

Post by cox »

Tested my latest branch on Linux Mint 17.2 in virtualbox(No 3d acceleration), with test workbench completing with no errors. :D

Any test on other platform or tips, would be much appreciated.
Need help? Feel free to ask, but please read the guidelines first
Post Reply