[app/code] Wipe scripts when adding one with opt

This commit is contained in:
M4x1m3
2020-07-23 11:02:03 +02:00
parent f582ce0e6d
commit 587ea39aaf
2 changed files with 7 additions and 3 deletions

View File

@@ -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<char *>(UTF8Helper::CodePointSearch(value, ':'));
if (*separator == 0) {
return;

View File

@@ -34,6 +34,7 @@ public:
private:
#if EPSILON_GETOPT
bool m_lockOnConsole;
bool m_hasBeenWiped;
#endif
ScriptStore m_scriptStore;
};