Kaynağa Gözat

Warn if node cannot access filesystem

master
Massimo 5 yıl önce
ebeveyn
işleme
60f07d8edd
3 değiştirilmiş dosya ile 13 ekleme ve 4 silme
  1. +4
    -0
      CHANGELOG.md
  2. +8
    -3
      boolean-logic-ultimate/BooleanLogicUltimate.js
  3. +1
    -1
      package.json

+ 4
- 0
CHANGELOG.md Dosyayı Görüntüle

# node-red-contrib-boolean-logic-ultimate # node-red-contrib-boolean-logic-ultimate
<p> <p>
<b>Version 0.0.5</b><br/>
- Bypass persistency if node-red user hasn't permissions to write to the filesystem.<br/>
</p>
<p>
<b>Version 0.0.4</b><br/> <b>Version 0.0.4</b><br/>
- Fixed conflict issue if you have the old boolean logic installed<br/> - Fixed conflict issue if you have the old boolean logic installed<br/>
</p> </p>

+ 8
- 3
boolean-logic-ultimate/BooleanLogicUltimate.js Dosyayı Görüntüle

node.status({fill: "blue",shape: "ring",text: "Loaded persistent states (" + Object.keys(node.state).length + " total)."}); node.status({fill: "blue",shape: "ring",text: "Loaded persistent states (" + Object.keys(node.state).length + " total)."});
} }
} catch (error) { } catch (error) {
node.status({fill: "grey",shape: "ring",text: "No persistent states"});
node.status({fill: "grey",shape: "ring",text: "No persistent states: " + error});
} }
} else { } else {


// Sabe the state array to a perisistent file // Sabe the state array to a perisistent file
if (this.config.persist == true) { if (this.config.persist == true) {
if (!fs.existsSync("states")) fs.mkdirSync("states");
fs.writeFileSync("states/" + node.id.toString(),JSON.stringify(state));
try {
if (!fs.existsSync("states")) fs.mkdirSync("states");
fs.writeFileSync("states/" + node.id.toString(),JSON.stringify(state));
} catch (error) {
node.status({fill: "red",shape: "dot",text: "Node cannot write to filesystem: " + error});
}
} }
// Do we have as many inputs as we expect? // Do we have as many inputs as we expect?

+ 1
- 1
package.json Dosyayı Görüntüle

{ {
"name": "node-red-contrib-boolean-logic-ultimate", "name": "node-red-contrib-boolean-logic-ultimate",
"version": "0.0.4",
"version": "0.0.5",
"description": "A set of Node-RED enhanced boolean logic, with persisten values after reboot and more", "description": "A set of Node-RED enhanced boolean logic, with persisten values after reboot and more",
"author": "Supergiovane (https://github.com/Supergiovane)", "author": "Supergiovane (https://github.com/Supergiovane)",
"dependencies": { "dependencies": {

Yükleniyor…
İptal
Kaydet