rmlint icon indicating copy to clipboard operation
rmlint copied to clipboard

Add relative symlinking to the symlink process

Open Suika opened this issue 4 years ago • 2 comments

I noticed that rmlint only does absolute links due to the way the files are passed to the link executable. It would be nice to have the ability to set a flag, that will create relative links. ie. ln -s -r. https://github.com/sahib/rmlint/blob/master/lib/formats/sh.sh#L176 If that option is set, ln will not create an absolute path and will find the shortest way to the target.

I think I saw an issue that fixed the lookup of the symlinks that contain relative paths, so this should be safe. Well, I can always edit the generated rmlint.sh and it will work due to the proper way rmlint references and uses the commands.

Suika avatar May 31 '21 12:05 Suika

You can do this now via:

$ rmlint -o sh -c sh:cmd='echo "symlinking to original $2" && rm -rf "$1" && ln -s -r  "$2" "$1"'

Or we could add an option like rmlint -c sh:symlink -c sh:relative

SeeSpotRun avatar May 31 '21 20:05 SeeSpotRun

Pretty sure -c sh:relative is less prone to problems and easer to comprehend than the other thing you wrote out. Mess sh:cmd= up and things could go wrong.

Suika avatar Jun 01 '21 11:06 Suika