Project

General

Profile

Actions

Feature #18925

closed

Add `FileUtils.ln_sr` to create symbolic links relative to link location

Added by nobu (Nobuyoshi Nakada) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:109241]

Description

Usual File.symlink (and ln -s) creates a symbolic link as the given argument.
GNU coreutils ln has -r (--relative) option, which resolves the source path relative to the current directory as relative to the link location.

$ mkdir src dest
$ echo ok > src/x
$ ln -s src/x dest
$ readlink dest/x 
src/x
$ cat dest/x
cat: dest/x: No such file or directory
$ rm dest/x
$ ln -sr src/x dest
$ readlink dest/x 
../src/x
$ cat dest/x 
ok
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Description updated (diff)
Actions #3

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|c6330cd32b7d02b4603080a2c53d64be9e05773c.


[ruby/fileutils] [Feature #18925] Add ln_sr method and relative: option to ln_s

https://github.com/ruby/fileutils/commit/5116088d5c

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0