Skip to content

Commit

Permalink
make symlinks relative if possible - fixes #94
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmck committed Jul 5, 2016
1 parent f4738df commit 36d73cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/util/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ export async function symlink(src: string, dest: string): Promise<void> {
}

try {
await fsSymlink(src, dest, "junction");
if (process.platform === "win32") {
// use directory junctions if possible on win32, this requires absolute paths
await fsSymlink(src, dest, "junction");
} else {
// use relative paths otherwise which will be retained if the directory is moved
await fsSymlink(path.relative(path.dirname(dest), src), dest);
}
} catch (err) {
if (err.code === "EEXIST") {
// race condition
Expand Down

1 comment on commit 36d73cc

@stefanpenner
Copy link
Contributor

@stefanpenner stefanpenner commented on 36d73cc Jan 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes some issues: more on the issues here

Please sign in to comment.