Files
homebridge/lib/user.js
Nick Farina a3c0df1c7c Plugin support
- Homebridge is now designed to be `npm install`d globally and
executed via "homebridge" script
  - Remove all specific accessories/platforms except for an example
  - New internal structure and "cli"
2015-10-18 16:34:21 -07:00

36 lines
646 B
JavaScript

var path = require('path');
var fs = require('fs');
'use strict';
module.exports = {
User: User
}
/**
* Manages user settings and storage locations.
*/
// global cached config
var config;
function User() {
}
User.config = function() {
return config || (config = Config.load(User.configPath()));
}
User.storagePath = function() {
var home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
return path.join(home, ".homebridge");
}
User.configPath = function() {
return path.join(User.storagePath(), "config.json");
}
User.persistPath = function() {
return path.join(User.storagePath(), "persist");
}