From 34bfb70045e7e5ed47b6b3bfca44214e92c8c2dc Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 16 Sep 2024 19:17:41 +0200 Subject: [PATCH] Use the new test command in decai to avoid catting unexistent files --- decai/decai.r2.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/decai/decai.r2.js b/decai/decai.r2.js index 1b6c852..839662f 100644 --- a/decai/decai.r2.js +++ b/decai/decai.r2.js @@ -326,10 +326,12 @@ You can also make r2ai -w talk to an 'r2ai-server' using this line: let count = 0; let text = ""; if (decaiContextFile !== "") { + if (r2.cmd2("test -f " + decaiContextFile).value === 0) { text += "Context:\n"; - text += "[RULES]\n"; - text += r2.cmd("cat " + decaiContextFile); - text += "[/RULES]\n"; + text += "[RULES]\n"; + text += r2.cmd("cat " + decaiContextFile); + text += "[/RULES]\n"; + } } const origColor = r2.cmd("e scr.color"); r2.cmd("e scr.color=0");