mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-09 06:13:11 +01:00
@@ -13,6 +13,7 @@ module.exports = function() {
|
|||||||
program
|
program
|
||||||
.version(version)
|
.version(version)
|
||||||
.option('-P, --plugin-path [path]', 'look for plugins installed at [path] as well as the default locations ([path] can also point to a single plugin)', function(p) { Plugin.addPluginPath(p); })
|
.option('-P, --plugin-path [path]', 'look for plugins installed at [path] as well as the default locations ([path] can also point to a single plugin)', function(p) { Plugin.addPluginPath(p); })
|
||||||
|
.option('-H, --homebridge-home [path]', 'look for homebridge user files at [path] instead of the default location (~/.homebridge)', function(p) { User.setStoragePath(p); })
|
||||||
.option('-D, --debug', 'turn on debug level logging', function() { require('./logger').setDebugEnabled(true) })
|
.option('-D, --debug', 'turn on debug level logging', function() { require('./logger').setDebugEnabled(true) })
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ module.exports = {
|
|||||||
// global cached config
|
// global cached config
|
||||||
var config;
|
var config;
|
||||||
|
|
||||||
|
// optional custom storage path
|
||||||
|
var customStoragePath;
|
||||||
|
|
||||||
function User() {
|
function User() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +25,7 @@ User.config = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
User.storagePath = function() {
|
User.storagePath = function() {
|
||||||
|
if (customStoragePath) return customStoragePath;
|
||||||
var home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
var home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||||
return path.join(home, ".homebridge");
|
return path.join(home, ".homebridge");
|
||||||
}
|
}
|
||||||
@@ -33,3 +37,7 @@ User.configPath = function() {
|
|||||||
User.persistPath = function() {
|
User.persistPath = function() {
|
||||||
return path.join(User.storagePath(), "persist");
|
return path.join(User.storagePath(), "persist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
User.setStoragePath = function(path) {
|
||||||
|
customStoragePath = path;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user