When copying/moving a relative symlink via cut/copy + paste, Nautilus should recalculate the stored relative path so the link remains valid in its new location (equivalent to ln -rsfn). Currently, it just moves the relative symlink exactly as is, which leads to a broken link.
Is this something that would be relatively easy to include in the next gnome release?
Isn’t that what hardlinks are for? I think Nautilus currently can’t create hardlinks but maybe there’s a script or extension for the same.
I’ve relied on the current behavior for symlinks. For (not software) project directories I’ve used symlinks for quick access deep in a project’s directory structure. For new projects I could simply copy the symlinks from an old project. What you propose would when copying a symlink to a new project change it to point to the old project.
Not quite. You are thinking of absolute symlinks. Absolute symlinks point to an absolute location, like /home/user/Downloads/file.txt. A relative symlink instead points to a location like ./path/to/location/file.txt. Both of these are pretty much just special files saying to point elsewhere.
A hard link is indistinguishable from the original file. Once you create a hard link, both files are exactly the same. Not copies, they point to the exact same location on disk (not a path, but an inode).
Regardless of whether or not hardlinks would work here, I think recalculation of relative symlinks is a basic feature that should be supported. ln has built-in support for this, so it must be possible to add this to Nautilus.
The use-case which motivated me to start this is that I had a relative symlink (where an absolute symlink is not the best for my particular use-case) which I wanted to move into a sub-directory. Doing so with Nautilus just causes the link to break since the symlink is no longer correct. So, I have to resort to using ln -rnsf in the terminal to recalculate and fix the symlink. It would be nice if Nautilus could do this automatically.