mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-25 20:18:25 +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
|
@ -30,7 +30,7 @@ const fs = require('graceful-fs');
|
|||
const later = require('later');
|
||||
const temptmp = require('temptmp').createTrackedSession('ftn_bso');
|
||||
const assert = require('assert');
|
||||
const gaze = require('gaze');
|
||||
const sane = require('sane');
|
||||
const fse = require('fs-extra');
|
||||
const iconv = require('iconv-lite');
|
||||
const uuidV4 = require('uuid/v4');
|
||||
|
@ -1654,10 +1654,18 @@ FTNMessageScanTossModule.prototype.startup = function(cb) {
|
|||
}
|
||||
|
||||
if(_.isString(importSchedule.watchFile)) {
|
||||
gaze(importSchedule.watchFile, (err, watcher) => {
|
||||
watcher.on('all', (event, watchedPath) => {
|
||||
if(importSchedule.watchFile === watchedPath) {
|
||||
tryImportNow(`Performing import/toss due to @watch: ${watchedPath} (${event})`);
|
||||
const watcher = sane(
|
||||
paths.dirname(importSchedule.watchFile),
|
||||
{
|
||||
glob : `**/${paths.basename(importSchedule.watchFile)}`
|
||||
}
|
||||
);
|
||||
|
||||
[ 'change', 'add', 'delete' ].forEach(event => {
|
||||
watcher.on(event, (fileName, fileRoot) => {
|
||||
const eventPath = paths.join(fileRoot, fileName);
|
||||
if(paths.join(fileRoot, fileName) === importSchedule.watchFile) {
|
||||
tryImportNow(`Performing import/toss due to @watch: ${eventPath} (${event})`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue