From 587ea39aaf1456f529f24d39ad138ed6edf8a2e8 Mon Sep 17 00:00:00 2001 From: M4x1m3 Date: Thu, 23 Jul 2020 11:02:03 +0200 Subject: [PATCH] [app/code] Wipe scripts when adding one with opt --- apps/code/app.cpp | 9 ++++++--- apps/code/app.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/code/app.cpp b/apps/code/app.cpp index 9de25b735..3b599e827 100644 --- a/apps/code/app.cpp +++ b/apps/code/app.cpp @@ -25,6 +25,7 @@ const Image * App::Descriptor::icon() { App::Snapshot::Snapshot() : #if EPSILON_GETOPT m_lockOnConsole(false), + m_hasBeenWiped(false), #endif m_scriptStore() { @@ -49,10 +50,12 @@ bool App::Snapshot::lockOnConsole() const { } void App::Snapshot::setOpt(const char * name, const char * value) { - if (strcmp(name, "wipe") == 0) { - m_scriptStore.deleteAllScripts(); - } if (strcmp(name, "script") == 0) { + if (!m_hasBeenWiped) { + m_hasBeenWiped = true; + m_scriptStore.deleteAllScripts(); + } + char * separator = const_cast(UTF8Helper::CodePointSearch(value, ':')); if (*separator == 0) { return; diff --git a/apps/code/app.h b/apps/code/app.h index 2deeb7f03..a42979e1e 100644 --- a/apps/code/app.h +++ b/apps/code/app.h @@ -34,6 +34,7 @@ public: private: #if EPSILON_GETOPT bool m_lockOnConsole; + bool m_hasBeenWiped; #endif ScriptStore m_scriptStore; };