Skip to content

Commit

Permalink
Resolve realpaths for targetBinLoc and pkgLoc in linkSelfDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne committed Jul 5, 2016
1 parent def4e54 commit d8059ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/package-linker.js
Expand Up @@ -40,6 +40,8 @@ export default class PackageLinker {
config: Config;

async linkSelfDependencies(pkg: Manifest, pkgLoc: string, targetBinLoc: string): Promise<void> {
targetBinLoc = await fs.realpath(targetBinLoc);
pkgLoc = await fs.realpath(pkgLoc);
for (let [scriptName, scriptCmd] of entries(pkg.bin)) {
let dest = path.join(targetBinLoc, scriptName);
let src = path.join(pkgLoc, scriptCmd);
Expand Down
6 changes: 1 addition & 5 deletions src/util/fs.js
Expand Up @@ -153,11 +153,7 @@ export async function symlink(src: string, dest: string): Promise<void> {
await fsSymlink(src, dest, "junction");
} else {
// use relative paths otherwise which will be retained if the directory is moved
let relative = src;
if (path.isAbsolute(relative)) {
relative = path.relative(path.dirname(dest), src);
}

let relative = path.relative(path.dirname(dest), src);
await fsSymlink(relative, dest);
}
} catch (err) {
Expand Down

0 comments on commit d8059ad

Please sign in to comment.