diff --git a/.gitignore b/.gitignore index 91671227..dee1566e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ .node-version npm-debug.log .idea +.vscode diff --git a/lib/filesystem.js b/lib/filesystem.js index f61c0410..27b00a1b 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -99,7 +99,9 @@ class Filesystem { } insertLink (p) { - const link = path.relative(fs.realpathSync(this.src), fs.realpathSync(p)) + const symlink = fs.readlinkSync(p) + const parentPath = path.dirname(p) + const link = path.relative(fs.realpathSync(this.src), path.join(parentPath, symlink)) if (link.substr(0, 2) === '..') { throw new Error(`${p}: file "${link}" links out of the package`) }