Skip to content

Commit 36d73cc

Browse files
committed
make symlinks relative if possible - fixes #94
1 parent f4738df commit 36d73cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/util/fs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ export async function symlink(src: string, dest: string): Promise<void> {
148148
}
149149

150150
try {
151-
await fsSymlink(src, dest, "junction");
151+
if (process.platform === "win32") {
152+
// use directory junctions if possible on win32, this requires absolute paths
153+
await fsSymlink(src, dest, "junction");
154+
} else {
155+
// use relative paths otherwise which will be retained if the directory is moved
156+
await fsSymlink(path.relative(path.dirname(dest), src), dest);
157+
}
152158
} catch (err) {
153159
if (err.code === "EEXIST") {
154160
// race condition

0 commit comments

Comments
 (0)