On 08/02/2019 09:04, Chris Good wrote:
-----Original Message-----
From: Geert Janssens <geert.gnuc...@kobaltwit.be>
Sent: Wednesday, 6 June 2018 12:10 AM
To: gnucash-devel@gnucash.org
Cc: Chris Good <goodchri...@gmail.com>
Subject: Re: [GNC-dev] GnuCash 3 on Linux

Op dinsdag 5 juni 2018 14:53:44 CEST schreef Chris Good:
Hi,

I'm working on my BackupGnuCash stand-alone app.

I have 2 questions today:

1.

I'm a little uncertain about where the saved reports and metadata
files are in GnuCash 3.0 for Linux.

I suspect they are by default:

~/.local/share/gnucash/saved-reports-2.4
  2.8, not 2.4. If not 2.8 file is found, gnucash 3 and up will search for a
saved-reports-2.4, but it will only save to saved-reports-2.8.

~/.local/share/gnucash/books/[BOOK].gnucash.gcm


Yes. Do note it can be [BOOK].gnucash_<number>.gcm if you have several data
files named [BOOK]. And the gnucash part in that file name is only there if
the data file is called [BOOK].gnucash. Older versions of gnucash also
allowed to save to files without extension or with the .xac extension.
So it's really [BOOK-WITH-EXTENSION]<optional _NUMBER>.gcm

our elders and betters DID NOT THINK THIS THROUGH

unless overridden by XDG_DATA_HOME.

If you override XDG_DATA_HOME the files will be searched for and saved in
$XDG_DATA_HOME/gnucash/

However this can be overridden even with GNC_DATA_HOME. If that's set,
gnucash will search and save in $GNC_DATA_HOME (which may or may not end in
"/gnucash" unlike the XDG_DATA_HOME to which gnucash will always append
"/gnucash")

basically you don't know where anything is, sailor.

Hi Geert,

Thanks very much for the above info.
I'm afraid it has been quite a while since these emails but hopefully now I
have a chance to follow up.

I was surprised to learn about the <optional _NUMBER> part of
[BOOK-WITH-EXTENSION]<optional _NUMBER>.gcm as I have never seen this.
I did some testing in Windows & Linux and I think I realise now how it
works.

you need to get the secret society part of gnc to document it then.

There is a guid in both the main data file and the metadata .gcm files.
For example,
In main data file:
<book:id type="guid">fe06ec827c69b29977e25a7c6c090229</book:id>

In .gcm:
BookGuid=fe06ec827c69b29977e25a7c6c090229

So when the metadata is saved, GnuCash looks for (or creates)  a .gcm file
with a BookGuid matching book:id.

It seems that when you create a new book by using File, New, the
subsequently saved main data file has a new book guid created.
However, if you create a new book by either:
1) manually copying a main data file to a different directory and/or
filename
Or
2) using File, Save As
there is no new book:id created so both books will continue to use the same
..gcm file.

Have you spotted the super simple "what files to backup" part yet?

I'm not sure and I really ought to know.

Actually I'm so unsure I'm leaving people on gnc 2.x because at least we know where stuff is.

I suspect there may be people who may like to have different settings for
different books but don't because they have created their new book by either
of the 1) or 2) methods above.

Don't confuse their little heads, they went with what the OS people said they should do. Obedience is good.

As the book:id guid only appears once in my main data file, I assume it may
be possible to correct this situation by:
a) save the main data file uncompressed
b) make a minor random(ish) change to the guid using a text editor (do NOT
change the length of the guid)
c) copy the old .gcm to a new .gcm (i.e. copy TEST.gnucash.gcm to
TEST.gnucash_2.gcm)
d) use a text editor to change the old guid to the new guid in the new .gcm

That is all "don't do this unless you know what you are doing" and "don't do this at home" stuff.

I'd like to document this in the wiki.
Can you please let me know if I have made any errors in my above assumptions
or forgotten anything important?

I think it unlikely you will be allowed to wiki this because our idiots in charge made an executive decision that (for example) reports and books don't belong to each other!

Seriously, they need not have a relationship. Even an invoice format (not something that belongs to each user) is now tucked away in each users private space making sensible and consistent backups near impossible.

I'm still recovering from the strangeness of that decision and have never got a sensible answer back from anyone about why they actually did it.

I think it would be useful if 2) above was changed so that a new book:id is
generated. Shall I raise a bug?

Go for it, bugs sometimes get listened to more than conversations.

--
Wm

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to