mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-09 22:24:35 +02:00
* Switch to sane over gaze for file watching: Gaze was not triggering on file additions
* Remove watching of config files for now -- doesn't work anyway. Will revisit later.
This commit is contained in:
parent
d5334270c4
commit
067bb9e884
4 changed files with 43 additions and 24 deletions
|
@ -6,7 +6,6 @@ var Log = require('./logger.js').log;
|
|||
|
||||
var paths = require('path');
|
||||
var fs = require('graceful-fs');
|
||||
var Gaze = require('gaze').Gaze;
|
||||
var events = require('events');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
|
@ -18,7 +17,7 @@ function ConfigCache() {
|
|||
|
||||
var self = this;
|
||||
this.cache = {}; // filePath -> HJSON
|
||||
this.gaze = new Gaze();
|
||||
//this.gaze = new Gaze();
|
||||
|
||||
this.reCacheConfigFromFile = function(filePath, cb) {
|
||||
fs.readFile(filePath, { encoding : 'utf-8' }, function fileRead(err, data) {
|
||||
|
@ -32,7 +31,7 @@ function ConfigCache() {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
this.gaze.on('error', function gazeErr(err) {
|
||||
|
||||
});
|
||||
|
@ -50,6 +49,7 @@ function ConfigCache() {
|
|||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -58,13 +58,13 @@ util.inherits(ConfigCache, events.EventEmitter);
|
|||
ConfigCache.prototype.getConfigWithOptions = function(options, cb) {
|
||||
assert(_.isString(options.filePath));
|
||||
|
||||
var self = this;
|
||||
// var self = this;
|
||||
var isCached = (options.filePath in this.cache);
|
||||
|
||||
if(options.forceReCache || !isCached) {
|
||||
this.reCacheConfigFromFile(options.filePath, function fileCached(err, config) {
|
||||
if(!err && !isCached) {
|
||||
self.gaze.add(options.filePath);
|
||||
//self.gaze.add(options.filePath);
|
||||
}
|
||||
cb(err, config, true);
|
||||
});
|
||||
|
@ -82,4 +82,4 @@ ConfigCache.prototype.getModConfig = function(fileName, cb) {
|
|||
this.getConfig(paths.join(Config.paths.mods, fileName), cb);
|
||||
};
|
||||
|
||||
module.exports = exports = new ConfigCache();
|
||||
module.exports = exports = new ConfigCache();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue