mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Merge pull request #491 from straccio/master
Added pluginPath based on npm
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,3 +10,5 @@ npm-debug.log
|
||||
# Ignore any extra plugins in the example directory that aren't in Git already
|
||||
# (this is a sandbox for the user)
|
||||
example-plugins
|
||||
|
||||
.idea
|
||||
@@ -67,7 +67,7 @@ Logger.prototype.log = function(level, msg) {
|
||||
|
||||
// prepend timestamp
|
||||
var date = new Date();
|
||||
msg = "[" + date.toLocaleString() + "]" + " " + msg;
|
||||
msg = chalk.white("[" + date.toLocaleString() + "]") + " " + msg;
|
||||
|
||||
func(msg);
|
||||
}
|
||||
|
||||
@@ -119,9 +119,10 @@ Plugin.getDefaultPaths = function() {
|
||||
} else {
|
||||
paths.push('/usr/local/lib/node_modules');
|
||||
paths.push('/usr/lib/node_modules');
|
||||
const exec = require('child_process').execSync;
|
||||
paths.push(exec('/bin/echo -n "$(npm -g prefix)/lib/node_modules"').toString('utf8'));
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
@@ -165,14 +166,12 @@ Plugin.installed = function() {
|
||||
|
||||
// reconstruct full path
|
||||
var pluginPath = path.join(requirePath, name);
|
||||
|
||||
try {
|
||||
// we only care about directories
|
||||
if (!fs.statSync(pluginPath).isDirectory()) continue;
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// does this module contain a package.json?
|
||||
var pjson;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user