-
Notifications
You must be signed in to change notification settings - Fork 743
Open
Labels
Description
Also inspired by #833.
ln -s is weird in that the semantics differ depending on whether it's given a relative path or an absolute path. For example:
$ touch file.txt
$ mkdir dir/
$ # Create a link, with an absolute path
$ ln -s "$PWD/file.txt" absoluteLink # ./absoluteLink is non-broken
$ mv absoluteLink dir/ # ./dir/absoluteLink is still non-broken
$ # Create a link, with a relative path
$ ln -s ./file.txt relativeLink # ./relativeLink is currently non-broken
$ mv relativeLink dir/ # But now ./dir/relativeLink is brokenI think shelljs does the right thing, but I'm not sure if our tests obviously handle this.
We should also consider making this explicit, but adding a utility function like utils.symlinkIsBroken(pathToLink).