node/deps/npm/node_modules/node-gyp/lib/list.js

34 lines
703 B
JavaScript
Raw Normal View History

module.exports = exports = list
exports.usage = 'Prints a listing of the currently installed node development files'
/**
* Module dependencies.
*/
2012-04-18 08:14:25 +08:00
var fs = require('graceful-fs')
, path = require('path')
2012-06-16 01:00:30 +08:00
, log = require('npmlog')
function list (gyp, args, callback) {
2012-06-16 01:00:30 +08:00
var devDir = gyp.devDir
log.verbose('list', 'using node-gyp dir:', devDir)
2012-06-16 01:00:30 +08:00
// readdir() the node-gyp dir
fs.readdir(devDir, onreaddir)
function onreaddir (err, versions) {
if (err && err.code != 'ENOENT') {
return callback(err)
}
if (versions) {
versions = versions.filter(function (v) { return v != 'current' })
} else {
versions = []
}
callback(null, versions)
}
}