GrandOrgue / GoOdf

A tool for creating/editing organ definition files for GrandOrgue
GNU General Public License v3.0
11 stars 1 forks source link

File references via symlinks #19

Closed William-Purvis closed 1 year ago

William-Purvis commented 1 year ago

Following discussion on the forum (for which I apologise, it should have been here), it occurs to me that the problems I saw with symlinks would be probably be avoided if it were possible to specify an ODF file as argument to the GOODF command. As the expansion of the argument would be taken relative to the current working directory and the symlinks would be avoided. It is also more conventional to use command arguments when doing any kind of edit. The changes needed for that are surely pretty trivial and of benefit to most users.

larspalo commented 1 year ago

No problem, but I'm sorry, I really don't understand your thought process here.

Currently when an .organ file is opened or created in GOODF a location of the .organ file should be established at the top of the panel when selecting the [Organ] item in the tree (which is seen when first starting GOODF). If you open an existing .organ file it should be set to exactly where you open that file as an absolute path. If you create a new organ it must be set with the "Browse.." button. All other paths written (to pipes, images etc.) will be relative to that location.

GOODF is not really intended to be a command line application, but rather a GUI application. Therefore everything should be possible to set from within the GUI of the program. And that is exactly the function of the "Location of the .organ file" text field in GOODF [Organ] panel. When you try to edit an .organ file what is the path shown to you in that text field?

When reading the documentation for wxFileName I find a few references to symbolic links, but I need to understand more in order to setup a test that possibly could re-produce the issue you've experienced. Do you think it would be enough to create a symlink to a directory containing the sample set in another place in the file system and test opening it from there?

larspalo commented 1 year ago

Testing a soft symlinked directory made with

ln -s /path/to/sample/set TestDirectory

the paths of a written .organ file are just fine and show nothing strange.

larspalo commented 1 year ago

You sure you haven't used something like

mount --bind /some/where /else/where

in /etc/fstab ?

William-Purvis commented 1 year ago

You sure you haven't used something like

|mount --bind /some/where /else/where|

in /etc/fstab ?Message ID: @.***>

I have two partitions: fstab: /dev/sda2    /home        ext4    errors=remount-ro    0    0 /dev/sda4    /away        ext4    errors=remount-ro    0    0 df: /dev/sda4       479G  305G  150G  67% /away /dev/sda2       432G  299G  111G  73% /home My 'normal' files are in /home/bill, while my organ files occupy /away/bill.

I have a symbolic link: /home/bill/Documents/GrandOrgue -> /away/bill/GrandOrgue

When I fire up GOODF and select File->Open it comes up with my home directory: /home/bill. I select Documents->GrandOrgue->Organs->Penketh->Penketh.organ which actually takes me to /away/bill/GrandOrgue/Organs/Penketh/Penketh.organ, but the path returned by the file selector (I am guessing here) is /home/bill/GrandOrgue/Organs/Penketh/Penketh.organ. I think that is what is confusing things.

-- +----------------------------------------+ | Bill Purvis | | @.*** | +----------------------------------------+

larspalo commented 1 year ago

I have a symbolic link: /home/bill/Documents/GrandOrgue -> /away/bill/GrandOrgue

And that symbolic link is done by ln -s?

When I fire up GOODF and select File->Open it comes up with my home directory: /home/bill. I select Documents->GrandOrgue->Organs->Penketh->Penketh.organ which actually takes me to /away/bill/GrandOrgue/Organs/Penketh/Penketh.organ, but the path returned by the file selector (I am guessing here) is /home/bill/GrandOrgue/Organs/Penketh/Penketh.organ.

I'd like to know exactly what path is reported as "Location of the .organ file" and also then see examples of what paths are reported for pipes and images.

Meanwhile I'm going to test symlinking to a portable usb hard drive and see what happens as my first test with symlinks within the same drive worked flawlessly and the paths written didn't change at all.

Anyway, my original statement that one should always work on the .organ files in exactly the position they are in relationship to the files it uses still holds true. If you instead just open the .organ file at /away/bill/GrandOrgue/Organs/Penketh/Penketh.organ everything should work as expected and all shall be well, right?

William-Purvis commented 1 year ago

On 05/05/2023 08:44, larspalo wrote:

I have a symbolic link:
/home/bill/Documents/GrandOrgue -> /away/bill/GrandOrgue

And that symbolic link is done by |ln -s|?

Yes, I'm not aware of any other way.

When I fire up GOODF and select File->Open it comes up with my home
directory: /home/bill.
I select Documents->GrandOrgue->Organs->Penketh->Penketh.organ
which actually takes me to
/away/bill/GrandOrgue/Organs/Penketh/Penketh.organ, but the path
returned
by the file selector (I am guessing here) is
/home/bill/GrandOrgue/Organs/Penketh/Penketh.organ.

I'd like to know exactly what path is reported as "Location of the .organ file" and also then see examples of what paths are reported for pipes and images.

If I simply go from my home directory via the link it comes up as /home/bill/Documents/GrandOrgue... and gives me the problems. If I step up from my home to the file system root and down through /away/bill/GrandOrgue... it works fine. But it a real drag going that way.

Meanwhile I'm going to test symlinking to a portable usb hard drive and see what happens as my first test with symlinks within the same drive worked flawlessly and the paths written didn't change at all.

Anyway, my original statement that one should always work on the .organ files in exactly the position they are in relationship to the files it uses still holds true. If you instead just open the .organ file at /away/bill/GrandOrgue/Organs/Penketh/Penketh.organ everything should work as expected and all shall be well, right?

Yes, but it's a pain. I don't see why you have to mess about with it, why not just copy the text as given.Message ID: @.***

-- +----------------------------------------+ | Bill Purvis | | @.*** | +----------------------------------------+

larspalo commented 1 year ago

Sorry, there must be something funky with your setup. I've just tested using a symlink on my local file system to a directory on an external hard drive and again all the paths are written just fine with perfect internal relations. And yes, I do see in GOODF that the "Location of the .organ file" is on my local disk not on the external.

SymlinkExt1

And the paths to the pipes are correctly shown in GOODF as relative the location of the .organ file.

SymlinkExt2

But when I write out the newly modified .organ file it's of course written back to the external hard drive, where I later can open it and examine the paths.

SymlinkExt3

So as you can see it's working exactly as it's supposed to in my tests. Since you get other results there must be something different in our setups.

Yes, but it's a pain. I don't see why you have to mess about with it, why not just copy the text as given.

I can't really see why it would be a pain to just open the real file in the file choosing dialog and work on it there. As for the need to "mess about with it", it's not just to "copy the text as given" because it's no text - it's an object referred to (a file). If you really want to deal with plain text "only" then any normal text editor should do the trick or even better use https://github.com/GrandOrgue/ODFEdit to handle any modifications. One of my goals with GOODF though, is to raise the quality of the .organ files written, becuase when people deal with "plain text" they usually end up with quite a few mistakes here and there as well as usually have some misunderstandings of how the odf logic works.