Tweak to LEDborg to use fs.exists rather than fs.read... no need to read and catch exception

This commit is contained in:
Dave C-J 2013-09-18 17:25:15 +01:00
parent 052aad50e6
commit 0878071a91
1 changed files with 5 additions and 3 deletions

View File

@ -18,9 +18,11 @@ var RED = require("../../red/red");
var util = require('util');
var fs = require('fs');
// read from /dev/ledborg to see if it exists - if not then don't even show the node.
try { var rc = fs.readFileSync("/dev/ledborg"); }
catch (err) { util.log("[77-ledborg.js] Error: PiBorg hardware : LedBorg not found"); return; }
// check if /dev/ledborg exists - if not then don't even show the node.
if (!fs.existsSync("/dev/ledborg")) {
util.log("[78-ledborg.js] Error: PiBorg hardware : LedBorg not found");
return;
}
function LedBorgNode(n) {
RED.nodes.createNode(this,n);