Suggestion: Support Relative Symbolic Links in Alt-F6, F5, and F6
Description of the new feature or improvement
It would be handy if there was a checkbox in the Link dialog that would specify that a symbolic link to be created should be a relative one (currently only absolute symlinks are created, which you then have to manually edit to make them relative).
Proposed technical implementation details (optional)
Obviously such a functionality should be limited to the same volume. I guess if the 2 paths (link source) and destination folder where the link should be created share the same path prefix, that prefix should be removed in the link, and then appropriate relative path be substituted for the rest of the link path.
In terms of UI a checkbox in the Link dialog should be added to indicate a preference for a relative link. The value of the checkbox should be remembered and persisted between sessions.
F5 Copy and F6 Move Support (Update)
I should elaborate a bit that this feature should be extended to copy and move operations, such that when Copy contents of symbolic links (for copy) is not selected, i.e. we are copying/moving the links themselves, and if they happen to be relative, there should be an option in FAR's copy/move dialog to update link targets as needed, such that they continue to point to the same target.
This would also, where appropriate turn relative links into absolute links - such as when copying/moving to another drive for example.
Of course, if the link is a junction, or if it is an absolute link, then no action can/should be taken (link copied/moved as is).
This however should be toggleable, i.e. be an option on a Copy/Move dialog, because often it may be appropriate to copy/move links verbatim (without reinterpretation).
Yes please! That checkbox'!... I'm also editing my new symlinks all the time manually. It's sad that Windows makes them so painful, and it's so nice that FAR supports them fairly conveniently -- it's just a relatively small step (that "Relative" checkbox) to make it even nicer.
-
Actually, since symlinks are so immensely useful, there should be some way to easily do a one-stop
MkSymLink, with conveniently auto-detecting the link type (dir/file) and applying a rememberedRelativechoice etc. Another remembered preference toMkLink(ie. the default link type to create) could do that. -
BTW
Copy contents of symbolic linkshas always been ambiguous to me, and I fail to remember which one it is: since it doesn't sayCopy targets of symbolic links(it should use that wording for following, or sg. like the "links themselves" if not), to me it means copying the contents of the links themselves (i.e. just the target path). But from the OP's last paragraph (which I'm not sure I understand, BTW) it seems that it's actually the opposite? :-o Sigh, I'll never remember that... (Not even the help text seems to clarify that unfortunately: it only says that FAR makes the distinction -- but not which option is which! :) Maybe the help text author also forgot, like me. ;) )
But from the OP's last paragraph (which I'm not sure I understand, BTW) it seems that it's actually the opposite
By
This however should be toggleable, i.e. be an option on a Copy/Move dialog, because often it may be appropriate to copy/move links verbatim (without reinterpretation).
I meant that sometimes when say copying a symlink from C:\baz with a target ..\foo\bar, it may be necessary to copy an absolute target nonetheless, i.e. such that the new (copied symlink)'s target will become C:\foo\bar (absolute) instead of continuing to be relative.
I see, thanks! Yes, that's a good idea. It's called "Stable symlinks" in Midnight Commander (the console-mode file manager from the homeland of symlinks :) ).
(I was confused by "update link targets as needed", as a "link target" is the file a link points to -- just like you also used it in the rest of the sentence: "... point to the same target". The path to that target (so "target path" is fine) is actually the link's "value", or, alas, "contents" (as I noted previously about the confusing terminology -- BTW, just tried and FAR indeed means the "target", by "content", not the path stored in the link (its real content)... My brain still kinda refuses to accept that.)
Alt+F6 isn't really suitable for relative symlinks due to its nature: the existing object is set in stone (because the operation is performed on the "current file") and only the new object location can be specified. It works fine for copy/move, but for links the "new object" location is usually implicit ("current directory") and we want to specify the "existing object" location, so Alt+F6 logic is somewhat inverted.
Good news: F7 can also create links, including relative, in a more logical way. Unfortunately it only creates directory links, but we can probably extend Shift+F4 in a similar manner.
Still not sure why Alt+F6 is not suitable for relative links. The checkbox would merely be a convenience thing, not really changing the behavior. Yes, the existing object is set in stone, but we are onyl talking about whether the resulting link's target would be absolute or relative (if allowed by the link type of course) - they would still point to the same object obviously.
Good news: F7 can also create links, including relative, in a more logical way.
But how would one use to easily create a relative symlink to an existing folder without having to type the target's path manually?
Unfortunately it only creates directory links, but we can probably extend Shift+F4 in a similar manner.
Shift+F4? Did you mean Shift+F7?
Still not sure why Alt+F6 is not suitable for relative links
I'm not saying it's entirely unsuitable and we should not add a checkbox or something, just that the UI logic isn't that intuitive in the first place.
without having to type the target's path manually
We probably have a keyboard shortcut for "insert path from the passive panel" somewhere.
Did you mean Shift+F7?
No. F7 creates directories, Shift+F4 creates files.