From fda928912fac82b38803a4f89f4e305168a92ed6 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Thu, 21 Oct 2021 14:07:33 +0200 Subject: [PATCH] prevent creating lots of zero-size debugger script files when autosave is enabled --- src/debugger/DebuggerParser.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 4ffce742a..d35d2ac99 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -690,16 +690,21 @@ string DebuggerParser::saveScriptFile(string file) FilesystemNode node(file); - try + if(node.exists() || out.str().length()) { - node.write(out); - } - catch(...) - { - return "Unable to save script to " + node.getShortPath(); - } + try + { + node.write(out); + } + catch(...) + { + return "Unable to save script to " + node.getShortPath(); + } - return "saved " + node.getShortPath() + " OK"; + return "saved " + node.getShortPath() + " OK"; + } + else + return "nothing to save"; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -