Location of assets on Linux

Discussions that concern the community rather than the makehuman software

Re: Location of assets on Linux

Postby Aranuvir » Sat Aug 04, 2018 1:28 pm

I ended up creating a new user just for MH-Py3 only to force MH to leave my existing data alone.
Really? :D The Python3 branch will create a new folder v1py3 inside ~/makehuman and won't touch any of your old stuff, though doing some backup from time to time might be recommendable, anyway. I've coexisting Py2 and Py3 data for a long time now without any problems, though I should consider to do some clean up actions to reduce disk space usage ...

I consider it necessary to make the default folder configurable

The problem here: we will need an extra configuration file at a known location. I'm a friend of keeping things tight and clean. If someone wants to remove MakeHuman he then not only has to delete the user data folder, but locate and remove further configuration files. Not my personal preference!
Aranuvir
 
Posts: 1314
Joined: Sun Oct 12, 2014 2:12 pm

Re: Location of assets on Linux

Postby punkduck » Sun Aug 05, 2018 10:11 am

Here is my proposal and I hope it is not like rewriting MakeHuman because of pathnames ;)

When installing MakeHuman on Linux, a small file in .config (like blender does) is created. This file only consists of the default pathname for the user documents,
For MacOS and Windows there are similar places to put the file, I guess. So we have an initial version and the empty directories are created under the default pathname, same as today. If it is possible to put the request for the pathname in the installer, the user can answer the question directly ... otherwise if the installation should not be changed, he is able to change it later at least.

If the user changes the pathname in this file, he knows what he is doing, Either he copies/moves his assets to the new location or MakeHuman creates the empty structure at the new place again, when he starts the software (in this case he can do the copy afterwards).

The settings.ini should be changed, so that the absolute paths are avoided (although they might be allowed, if the user himself changes them), my proposal is something like

Code: Select all
"loaddir": @@USERDIR@@/v1/models


Like in Blender, the settings should be saved on demand and not on each time when closing MakeHuman.

When you remove MakeHuman there is no problem. When somebody changed a location, he knows what to delete afterwards. And a file containing a single line in .config? As a Linux guy I had things even worse, like bla.rpmsave files in /etc/cron.d ... cron tries to start these as well. And when you remove thunderbird under Linux it will hopefully not remove the .thunderbird path in your home directory automatically, otherwise you will loose all your mbox files as well. We should leave the decision what to remove to the user, Of course we can add a few lines of documentation in the Wiki how to remove everything.

An optional parameter for the path is also useful. When we call MakeHuman with this pathname, the small configuration file will not be parsed. One possibility would be to put this statement with the pathname into a GUI starter (e.g. in xubuntu). But the main advantage for this parameter is to simplify development, because it could be useful to work with an alternative pathname (with less assets etc.).
User avatar
punkduck
 
Posts: 1216
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: Location of assets on Linux

Postby Aranuvir » Sun Aug 05, 2018 12:26 pm

As a Linux guy I had things even worse, like bla.rpmsave files in /etc/cron.d ... cron tries to start these as well.

That is absolutely not the way things should be done, in my opinion. That's the MS way with a polluted registry and traces of configuration files and shared libraries all over the file system :evil: .
We should leave the decision what to remove to the user[...]

I totally agree here. And best solution would be, everything is clean and tight at one easy to locate place, and the user does not have to go to multiple locations to get all files removed ...

The paths of settings.ini only remember the location where one lately has stored/loaded or exported a model, so it already provides a certain flexibility and it only makes sense to store absolute path names here, in my opinion. Though, the paths for all the other user data is not influenced. The user data folder is created on first run of MakeHuman (if it does not already exists, and missing sub folders will be automatically added). The location of this folder is controlled by the getHomePath() function of getpath.py which can be extended. We can think of allowing a makehuman.conf (or something similar) at known locations and if the file exists makehuman will redirect to the folder defined in this file. If the conf-file cannot be found MakeHuman will use the common location. We can think of writing a plugin to facilitate the process of creating such a conf-file and implement a copy data option. Though, I fear there will be ugly side effects if a module imports getpath again and settings were changed in the meanwhile. The next release of MakeHuman will allow loading plugins at runtime.

On Linux, I think, the file should be ~/.config/makehuman.conf and ~/.makehuman.conf, if ~/.config does not exists. On Windows it's probably the AppData/Local folder to store the file. Does anyone know if we must create a sub folder for the configuration file and the best way to get the location of AppData (reading registry keys or evaluating environment variables)? And where is the right place on MacOS?
Aranuvir
 
Posts: 1314
Joined: Sun Oct 12, 2014 2:12 pm

Re: Location of assets on Linux

Postby wolgade » Sun Aug 05, 2018 5:02 pm

Aranuvir wrote:Really? :D The Python3 branch will create a new folder v1py3 inside ~/makehuman and won't touch any of your old stuff,

This might be true when you installed MH (Python 2.7) the regular way. I use the source code. In this case the program resides under ~/makehuman/makehuman. I felt a bit uneasy about MH-Py3 messing around with ~/makehuman.
wolgade
 
Posts: 795
Joined: Wed Jan 30, 2013 6:50 pm

Re: Location of assets on Linux

Postby punkduck » Sun Aug 05, 2018 5:50 pm

Aranuvir wrote:On Linux, I think, the file should be ~/.config/makehuman.conf and ~/.makehuman.conf, if ~/.config does not exists. On Windows it's probably the AppData/Local folder to store the file. Does anyone know if we must create a sub folder for the configuration file and the best way to get the location of AppData (reading registry keys or evaluating environment variables)? And where is the right place on MacOS?


Well the MacOS is similar to Linux (internally it is build using POSIX standard). So a lot of tools behave like when they are on a Linux box. You e.g. have a directory ".atom" for the editor. Or ".config/gtk2.0" ... The way Mr. Apple :mrgreen: likes most is to use something like:

/Users/$USER/Library/Application Support/MakeHuman/<nameyourfilehere>

/Users/$USER is the MacOS way of Linux /home/$USER, but instead of hiding the directory they are using visible directory names which speak for themselves.

Here is the overview (including Windows) of Blender doing these things, maybe also a way for MakeHuman. We can also work "version-specific" with sub-directories ... if needed.

https://docs.blender.org/manual/en/dev/getting_started/installing/configuration/directories.html

Greetings from tropical Nürnberg ... :roll:
User avatar
punkduck
 
Posts: 1216
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: Location of assets on Linux

Postby Aranuvir » Sun Aug 05, 2018 6:39 pm

Well the job wasn't to complicated. If created a new branch to test on github: _feature_config_home. Currently it only works on Linux and Darwin derivates and assumes a .config folder. Beta testers are welcome. You can either create a .config/makehuman.conf or use a builtin tool under settings.

Just some remarks about Linux and Unix: Linux Standard Base is not necessarily POSIX compatible and IIRC the .config isn't defined by the LSB but by the XDG Base Directory Specification.

Greetings from the probably not less tropical rest of Europe... :D
Aranuvir
 
Posts: 1314
Joined: Sun Oct 12, 2014 2:12 pm

Previous

Return to Community discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron