-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
What was the purpose of building path (target) of __dirname in analyzer.dir? When I am analyzing file it works correctly with relative paths (if relative path is provided reaquire("fs"), path will be relative to process.cwd(), expected behaviour), but when I want to analyze folder, I need to provide full path or relative path from node_modules/require-analyzer, besause __dirname refers to directory name of the current module.
analyzer.path - works with relative paths
nalyzer.path = function(options, callback){
...
fs.stat(options.target, function (err, stats) {
analyzer.file - works with relative paths
function analyzeFile (options, callback) {
var remaining = 1;
function cb(err, data){
if(!--remaining) callback();
}
fs.readFile(options.target, function(err, data){
if(err) return callback(err);
analyzer.dir - doenst work with relative paths, resolve path with __dirname
analyzer.dir = function (options, callback) {
var target = path.resolve(__dirname, options.target);
//
// Read the target directory
//
fs.readdir(target, function (err, files) {
if (err) {
return callback(err);
}
Metadata
Metadata
Assignees
Labels
No labels