Change scann/toss watch msg again, use access() over exists()

This commit is contained in:
Bryan Ashby 2022-08-13 10:49:44 -06:00
parent 2e159a0cc6
commit 21d0ad9e59
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
1 changed files with 5 additions and 11 deletions

View File

@ -2778,16 +2778,9 @@ FTNMessageScanTossModule.prototype.startup = function (cb) {
});
const makeImportMsg = (e, path) => {
const indicator =
{
change: '~',
add: '+',
delete: '-',
exists: '=',
}[e] || '';
return `Import/toss due to @watch [${indicator}]: ${paths.basename(
return `Import/toss due to @watch[${e}] "${paths.basename(
path
)}`;
)}"`;
};
['change', 'add', 'delete'].forEach(event => {
@ -2806,8 +2799,9 @@ FTNMessageScanTossModule.prototype.startup = function (cb) {
// If the watch file already exists, kick off now
// https://github.com/NuSkooler/enigma-bbs/issues/122
//
fse.exists(importSchedule.watchFile, exists => {
if (exists) {
fse.access(importSchedule.watchFile, fse.constants.R_OK, err => {
if (!err) {
// exists and we can read
tryImportNow(
makeImportMsg('exists', importSchedule.watchFile),
{