Skip to content

Commit

Permalink
Merge pull request #7 from rosen-vladimirov/tivanova/handle-symlinks
Browse files Browse the repository at this point in the history
Handle symlinks
  • Loading branch information
tsvetie authored Jul 20, 2018
2 parents 6e8176b + 2a1d73e commit 4a7ec4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const getPath = (packageName, executableName) => {
}

let foundPath = null;

if (executableName) {
foundPath = platform === "win32" ?
getPathFromExecutableNameOnWindows(packageName, executableName) :
Expand All @@ -209,6 +210,14 @@ const getPath = (packageName, executableName) => {
foundPath = getPathFromNpmConfig(platform, packageName);
}

if (foundPath) {
try {
foundPath = fs.realpathSync(foundPath);
} catch (err) {
console.error(err.message);
}
}

return foundPath;
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "global-modules-path",
"version": "2.2.0",
"version": "2.3.0",
"description": "Returns path to globally installed package",
"main": "./lib/index.js",
"scripts": {
Expand Down

0 comments on commit 4a7ec4a

Please sign in to comment.