Hello, Tom:

On 2024-01-03 06:10, Tom Balazs wrote:
I want to attach an image of a bill to a transaction.
At a high level, let me say that I do similar things in my bookkeeping all the time. GnuCash handles it well.
I click Manage Document Link.
I get "Path head not set, using "/home/tom/" for relative paths.
Is that the best Path to use?
Where does GnuCash begin navigating from?
When you select the menu item "Transaction" -- "Manage Document Link...", the "Change a Transaction Linked Document" dialogue appears.

It lets you attach one of three kinds of link to transactions:

1. A "Linked File", with an absolute path to a file on your computer.
2. A "Linked File", with a relative path to a file on your computer.
3. A "Linked Location", that is, a URL which serves as a reminder for you.

The dialogue also displays the "path head for files", an absolute path to some directory on your computer. In the case where you store a linked file using relative path, GnuCash combines it with the path head to make an absolute path to the file.

It sounds like GnuCash noticed that you had never set the path head for files, so it let you know it was choosing a reasonable default.

You can change the path head for linked files setting in the GnuCash preferences, "General" tab, "Linked FIles" section. There is a pulldown menu which shows the current path head, and lets you use a File Open dialogue to choose a new path head. You can see this General tab of Settings in the GnuCash manual, section 10.2 "General", at <https://gnucash.org/docs/v5/C/gnucash-manual/set-prefs.html>. See Figure 10.4.

When you change the path head, GnuCash displays a dialogue with two check boxes. The first offers to change existing relative paths to absolute paths, by combining them with the existing path head. The second offers to change existing absolute paths, which point to the new path head directory or its subdirectories, into relative paths.

I believe, but have not read the code to confirm, that GnuCash will store a Linked File path as relative if it points to a location within your path head directory or its subdirectories. Otherwise, it will store the Linked File path as absolute. Certainly this is my model of how GnuCash works, and I have not seen evidence to contradict it.

(By the way, internally, the Linked File options are also URLs, with a "file:" protocol prefix. If you save the GnuCash book file in uncompressed XML format, you can open it up with a text editor and see the document link values. I did this once.)


I would like the path to be relative so that if I move all my GnuCash files
to another folder the document links will still work.

I do something very similar, so I am confident that you can do what you want.

I store my book file within a year-based Projects directory. Next to the book file is a subdirectory with my linked files. The following diagram may be legible if drawn with a fixed-pitch font:

|
+- 2024/ -+
|         +- book.gnucash
|         +- linked_files/
|
+- 2023/ -+
|         +- book.gnucash   [as of end of 2023]
|         +- linked_files/  [as of end of 2023]
| etc.

At the start of 2024, I created my "2024" directory. I copied the "linked_files" directory and all the files in it from the 2023 to the 2024 directory. I opened "book.gnucash" with GnuCash, then used the File -- Save as… menu item to store a copy of "book.gnucash" in "2024". I used the GnuCash preferences, "General" tab, "Linked FIles" section to change the path head from .../2023/linked_files/ to .../2024/linked_files/ . I left both boxes unchecked in the following dialogue box, so my relative Linked File paths remained relative.

Now, when I select a transaction with a linked file, and use menu item "Transaction" -- "Open Linked Document", GnuCash opens the copy of the file in .../2024/linked_files/... .

If that is the behaviour you want, it has worked well for me.

Best regards,
      —Jim DeLaHunt
_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to