Skip to content

Commit

Permalink
Merge pull request #27 from castor4bit/follow_node_path_symlink
Browse files Browse the repository at this point in the history
Follow symbolic links if it exists
  • Loading branch information
SBoudrias committed Dec 29, 2015
2 parents 411f23e + 2ab4d9e commit 25b0e1e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/rules/node_path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
var fs = require('fs');
var path = require('path');
var childProcess = require('child_process');
var message = require('../message');
Expand All @@ -25,7 +26,17 @@ var errors = exports.errors = {
};

function fixPath(filepath) {
return path.resolve(path.normalize(filepath.trim()));
var fixedPath = path.resolve(path.normalize(filepath.trim()));

try {
fixedPath = fs.realpathSync(fixedPath);
} catch (err) {
if (err.code !== 'ENOENT') {
throw err;
}
}

return fixedPath;
}

exports.verify = function (cb) {
Expand Down

0 comments on commit 25b0e1e

Please sign in to comment.