diff --git a/apps/code/app.cpp b/apps/code/app.cpp index efc7e6a94..4d18011c2 100644 --- a/apps/code/app.cpp +++ b/apps/code/app.cpp @@ -46,23 +46,23 @@ bool App::Snapshot::lockOnConsole() const { void App::Snapshot::setOpt(const char * name, char * value) { if (strcmp(name, "script") == 0) { - m_scriptStore.deleteAllScripts(); - char * separator = strchr(value, ':'); - if (!separator) { - return; - } - *separator = 0; - const char * scriptName = value; - /* We include the 0 in the scriptContent to represent the importation - * status. It is set to 1 after addScriptFromTemplate. Indeed, this '/0' - * char has two goals: ending the scriptName and representing the - * importation status; we cannot set it to 1 before adding the script to - * storage. */ - const char * scriptContent = separator; - Code::ScriptTemplate script(scriptName, scriptContent); - m_scriptStore.addScriptFromTemplate(&script); - m_scriptStore.scriptNamed(scriptName).toggleImportationStatus(); // set Importation Status to 1 + m_scriptStore.deleteAllScripts(); + char * separator = strchr(value, ':'); + if (!separator) { return; + } + *separator = 0; + const char * scriptName = value; + /* We include the 0 in the scriptContent to represent the importation + * status. It is set to 1 after addScriptFromTemplate. Indeed, this '/0' + * char has two goals: ending the scriptName and representing the + * importation status; we cannot set it to 1 before adding the script to + * storage. */ + const char * scriptContent = separator; + Code::ScriptTemplate script(scriptName, scriptContent); + m_scriptStore.addScriptFromTemplate(&script); + m_scriptStore.scriptNamed(scriptName).toggleImportationStatus(); // set Importation Status to 1 + return; } if (strcmp(name, "lock-on-console") == 0) { m_lockOnConsole = true; diff --git a/apps/code/console_controller.cpp b/apps/code/console_controller.cpp index b3cce8867..86075d0c7 100644 --- a/apps/code/console_controller.cpp +++ b/apps/code/console_controller.cpp @@ -33,7 +33,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe m_sandboxController(this), m_inputRunLoopActive(false) #if EPSILON_GETOPT - , m_locked(lockOnConsole) + , m_locked(lockOnConsole) #endif { m_selectableTableView.setMargins(0, Metric::CommonRightMargin, 0, Metric::TitleBarExternHorizontalMargin); diff --git a/python/port/port.cpp b/python/port/port.cpp index 68332186e..4c8a465a0 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -23,10 +23,6 @@ extern "C" { static MicroPython::ScriptProvider * sScriptProvider = nullptr; static MicroPython::ExecutionEnvironment * sCurrentExecutionEnvironment = nullptr; -MicroPython::ExecutionEnvironment::ExecutionEnvironment() : - m_sandboxIsDisplayed(false) -{ -} MicroPython::ExecutionEnvironment * MicroPython::ExecutionEnvironment::currentExecutionEnvironment() { return sCurrentExecutionEnvironment; diff --git a/python/port/port.h b/python/port/port.h index 697867c57..e28622c80 100644 --- a/python/port/port.h +++ b/python/port/port.h @@ -14,7 +14,7 @@ public: class ExecutionEnvironment { public: - ExecutionEnvironment(); + ExecutionEnvironment() : m_sandboxIsDisplayed(false) {} static ExecutionEnvironment * currentExecutionEnvironment(); void runCode(const char * ); virtual const char * inputText(const char * prompt) {