Op vrijdag 26 oktober 2018 18:52:33 CEST schreef aeneas: > One of the nice things about software designed to run on multiple platforms > is that it tends to avoid the use of platform specific features. I've had > very good success setting up various open source packages to run on Windows > in a portable fashion. While the Portable Apps > <https://portableapps.com/apps> offering has some very nice capabilities > there are a couple of issues that cause me to like my own method better. > One of these is the slowness with which new releases get transitioned to > their platform, which is the current case with GNUcash Version 3.3. > > I've attempted to setup GNUcash to run flash memory in a manner that it can > be easily taken from one computer to another. Coincidentally it looks like > GNUcash made a change in Version 3.3 that should make this work well. I > noticed that the files used for storing persistent state information have > been moved from a folder named ".gnucash" which was located in the folder > referenced by the Windows environment variable named "%HOMEPATH%" to the > folder referenced by the Windows environment variable named "%APPDATA%". > The problem is that it appears as though GNUcash does not bother to use > these environment variables but rather hard codes the folder names using > absolute paths assigned to the "C:\" drive with the default values for the > paths that Windows normally assigns to the indicated variables. > No, GnuCash calls SHGetSpecialFolderLocation (NULL, CSIDL_APPDATA, &pidl); See https://github.com/Gnucash/gnucash/blob/3.3/libgnucash/core-utils/gnc-filepath-utils.cpp#L486
While deprecated this is one way to retrieve that current APPDATA directory via the Windows API. I don't know if that function considers environment variables though. > Of course the reason for having these variables is so that the paths can be > changed external to the software that needs to use such storage. I cannot > think of a good reason for using these paths but ignoring the variables. The environment variables are a Windows thing. It's not clear to me whether applications are supposed to explicitly prefer them over whatever is returned by the Windows API. If you can point me to Microsoft guidelines in this respect we can evaluate this. > Rather if GNUcash did use these variables I suspect that it might work vary > well from a portable drive that could be used on different computers. Is > there any chance that GNUcash might consider doing something as normal as > this? > Well, we haven't established yet whether this is the "normal" thing to do. However I sympathize with your use case. You can handle it partly by setting GNC_DATA_HOME to the location where you want to store your data. However this will only handle part of the metadata and configuration files. If you have created your own guile based reports ("custom reports") or want to customize the gnucash gui, these files are stored in a directory that's internally known as "GNC_CONFIG_HOME". Unlike GNC_DATA_HOME this one can't be moved (yet) due to some oversight while implementing these changes. It is hardcoded to be APPDATA\GnuCash, with APPDATA retrieved as explained above. Note that this would still not be completely portable. Part of GnuCash' preferences are stored in the registry. So when moving to another PC, you'll lose these preferences. Altering them will taint the registry on that PC, which is not truly portable. Unless of course you also have a mechanism to redirect registry trees to a local file. I don't know enough of Windows to estimate if this is possible. Next, GnuCash depends on aqbanking. This has its own configuration directory in the user's home directory. If you use aqbanking you may want to set AQBANKING_HOME as well. Regards, Geert _______________________________________________ gnucash-user mailing list gnucash-user@gnucash.org To update your subscription preferences or to unsubscribe: https://lists.gnucash.org/mailman/listinfo/gnucash-user If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information. ----- Please remember to CC this list on all your replies. You can do this by using Reply-To-List or Reply-All.