[GNC] Relocating user specific application data to another directory
Geert Janssens
geert.gnucash at kobaltwit.be
Fri Oct 18 03:50:42 EDT 2019
Op zondag 29 september 2019 13:11:30 CEST schreef mark101:
> Hi Geert
>
> Since my last post, and after scouring the forums, I've had some success.
>
> I found that the following syntax worked in relocating my user data/config
> files to: C:\Users\Mark\AppData\Roaming\GnuCash\GnuCash
> GNC_DATA_HOME={Appdata}/Gnucash/GnuCash
> GNC_CONFIG_HOME={Appdata}/Gnucash/GnuCash
> Here's the enviroment.local file environment.local
> <http://gnucash.1415818.n4.nabble.com/file/t378751/environment.local>
>
>
> I also found that this syntax worked in relocating my user data/config files
> to: C:\Users\Mark\OneDrive\Documents\Gnucash_data\GnuCash
> GNC_DATA_HOME=C:/Users/Mark/OneDrive/Documents/Gnucash_data/GnuCash
> GNC_CONFIG_HOME=C:/Users/Mark/OneDrive/Documents/Gnucash_data/GnuCash
> Here's the enviroment.local file environment.local
> <http://gnucash.1415818.n4.nabble.com/file/t378751/environment.local>
>
>
> Whilst the syntax worked, do you have any suggestions on how this syntax may
> be simplified/improved or references/links to help my understanding of it?
>
Hi Mark,
I'm glad it worked.
I'm not sure what you mean by "how this syntax may be simplified/improved".
As for references, the file format is based on GLib's Key File format
https://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html#glib-Key-value-file-parser.description
It's simplified in that it won't use translated strings and GnuCash will
currently only interpret values in a "Variables" section.
Other than that, as the variables should be able to depend on system
environment variables, we have added a simple syntax extension to include the
names for system environment variables. Any bit of text enclosed in { and }
is interpreted as a system environment variable and will be expanded to the
value of that variable. On Windows there's the variable APPDATA (or appdata is
it's case insensitive). This variable is set by default by the system, and on
your system with user Mark will be set to
C:\Users\Mark\AppData\Roaming
Other variables could be used in the same way as well if they exist and make
sense. You'll find examples in the environment file itself, including a short
intro on what this file does and how to use it.
Note also that file paths on Windows can use either \ or / as path separator.
So as far as Windows is concerned
C:\Users\Mark\AppData\Roaming\GnuCash\GnuCash
and
C:/Users/Mark/AppData/Roaming/GnuCash/GnuCash
are the same directory.
And you can use either format in the environment file as well with one
important caveat: \ acts as escape character for the key file parser. So if
you want to use \ as path separator, you'll need to use its escaped form \\.
That is explained in the link I have pasted above as well.
So in the environment file these two are equivalent and both refer to
C:\Users\Mark\AppData\Roaming\GnuCash\GnuCash
* GNC_DATA_HOME={Appdata}\\Gnucash\\GnuCash
* GNC_DATA_HOME={Appdata}/Gnucash/GnuCash
Hope that helps,
Geert
More information about the gnucash-user
mailing list