[SOLVED] Portable FreeCAD(user.cfg, system.cfg and Addon Manager)

Having trouble installing or compiling FreeCAD? Get help here.
Smiling_user
Posts: 173
Joined: Tue Jul 28, 2020 7:31 am

Re: [SOLVED]_Portability?: Portable FreeCAD Help with DirsPath coding

Post by Smiling_user » Fri Sep 11, 2020 7:25 pm

CHANGES MADE in the AddonManager:
getUserAppDataDir -> FreeCAD.getHomePath
Mod -> ModM -> User-downloaded addons will be stored in the folder ModM

These changes are intended to make FC completely portable - in a single folder. Did similar changes several times.
Sometimes they worked normally and without interference with any other install - all was working in a single folder.
Once AddonManager worked perfectly - with all functionality (workbenches download, upgrade, review, use).
But without VCS/GIT I lost that version of code and did not yet recover.
Now working on linux - so further work in this direction is postponed. But if this is so important for you I may try some modifications again.
User avatar
sgrogan
Posts: 6087
Joined: Wed Oct 22, 2014 5:02 pm

Re: Portability?: Portable FreeCAD Help with DirsPath coding

Post by sgrogan » Fri Sep 11, 2020 8:51 pm

Let's try to test what has been implemented.
I post a build here: https://github.com/sgrogan/FreeCAD/rele ... g/Portable
Always use the FreeCAD.bat file. Don't double click on a FreeCAD file as obviously the portable version will not write any thing to the registery and FreeCAD will use the file association in the registery.

I suggest extracting in the Downloads folder and testing.
Then move the folder to Documents to test portability.
I have no issues with normal preferences or Addons-manager.
The only issues I've seen is when setting a Path in preferences as it is hardcoded in user.cfg. For me the Macros directory suffers from this.
We can most likely overcome this by running a starter.py macro that writes the relative path as a hard coded path at each startup.

Please try to explain exactly what you did when you get an error. "It doesn't work sometimes" isn't going to advance the solution.

EDIT: And if this isn't solved, please remove this from the OP
"fight the good fight"
Smiling_user
Posts: 173
Joined: Tue Jul 28, 2020 7:31 am

Re: [SOLVED]_Portability?: Portable FreeCAD Help with DirsPath coding

Post by Smiling_user » Fri Sep 11, 2020 10:55 pm

// First to mention - I did not use the *.bat


In general modifying the code of AddonManager code there were next issues:
  • Addon manager item disappears from Tools-menu
  • Does not start
  • Starts, but no plugins downloaded nor installed plugins shown // copy-paste to Mod - installed plugins are available.
  • Starts, downloads list of plugins, but does not highlight installed. // copy-paste to Mod - installed plugins are available.
The last version ( in the pack)
  • Starts, downloads, highlights and updates plugins in FreeCad-0.19_pre//ModM (Custom folder).
BUT! Installed plugins are not available in workbenches list not in the WB-selection, no in the Tools>Customize.

The wished functionality of AddonManager would be at first to have it reading the Mod-path from user.cfg.
This would also ease development: possible to easily change combinations of WB-s installed.
Also this is needed for the case, to use some not updated(Py2) add-ons with previous versions of FC.
example: 0.17 - on the same machine.
In the dreaming-case would be to have ModPy2 directory, ModPy3 and ModPyNeutral directories and use some addons with both versions, and some - separately, having AddonManager to take more than one path from user.cfg.
Smiling_user
Posts: 173
Joined: Tue Jul 28, 2020 7:31 am

Re: Portability?: Portable FreeCAD Help with DirsPath coding

Post by Smiling_user » Fri Sep 11, 2020 11:08 pm

sgrogan wrote:
Fri Sep 11, 2020 8:51 pm
EDIT: And if this isn't solved, please remove this from the OP
Did I understand you right - to change the heading of the topic? Or you meant the files pack with incomplete AddonManager change?

How deep are changes to the code in your portable version?
Will try this pack as soon as start windows again.

// Installed docker+VSCode - now going to install FC source-code. If any recommendations...
User avatar
sgrogan
Posts: 6087
Joined: Wed Oct 22, 2014 5:02 pm

Re: Portable FreeCAD(user.cfg, system.cfg and Addon Manager)

Post by sgrogan » Sat Sep 12, 2020 1:48 pm

Smiling_user wrote:
Fri Sep 11, 2020 11:08 pm
Did I understand you right - to change the heading of the topic?
Yes, thank-you.
Smiling_user wrote:
Fri Sep 11, 2020 11:08 pm
How deep are changes to the code in your portable version?
There are no changes to the FreeCAD Source. I simply use a .bat file to set some env-variables as suggested by wmayer (his name is on the splash screen we should heed his advice).

If you just want an isolated version of FreeCAD on a machine, I cannot find anything that does not work.
If the version is to be seemlessly portable the hardcoded paths in user.cfg needs to be addressed. This is to be expected. These paths are user setable so FreeCAD must respect the absolute path.

On Linux this will be more difficult as FreeCAD uses system libraries for the dependencies. This can probably be overcome using the .AppImage.
"fight the good fight"
User avatar
sgrogan
Posts: 6087
Joined: Wed Oct 22, 2014 5:02 pm

Re: Portable FreeCAD(user.cfg, system.cfg and Addon Manager)

Post by sgrogan » Sat Sep 12, 2020 2:12 pm

Smiling_user wrote:
Fri Sep 11, 2020 11:08 pm
// Installed docker+VSCode - now going to install FC source-code. If any recommendations...
The directions here are excellent: Compile_on_Windows

I use the following tool chain.
git (source version control), CMake (Build system), VS2019 CE (IDE, linker, compiler), FreeCADLibs_12.1.4_x64_VC15.7z (FreeCAD Dependencies)
I use 7zip (file compression extraction) and Notepad++ (text editor)

I typically use the latest versions of the toolchain, but if you want a more bullet-proof process follow the version recommendations and instructions from Compile_on_Windows exactly.
"fight the good fight"
Smiling_user
Posts: 173
Joined: Tue Jul 28, 2020 7:31 am

Re: Portability?: Portable FreeCAD Help with DirsPath coding

Post by Smiling_user » Sun Sep 13, 2020 8:41 pm

sgrogan wrote:
Fri Sep 11, 2020 8:51 pm
Let's try to test what has been implemented. I post a build here: https://github.com/sgrogan/FreeCAD/rele ... g/Portable
Tried to use your version. something did not work for me in the downloaded.
But!! The FreeCad.bat worked well!!. The only thing - made little change to place it alongside the "bin" folder.

And now it looks like FreeCad.bat:

Code: Select all

set CURRENTDIR=%cd%
set FREECAD_USER_HOME=%CURRENTDIR%
start bin\FreeCAD.exe --write-log
This file will be attached to the header post of topic.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests