From 6ace6b9b69409e9df0f804867c023bb349ddad12 Mon Sep 17 00:00:00 2001 From: Spacehuhn Date: Fri, 11 Nov 2022 12:19:36 +0100 Subject: [PATCH] Auto create main_script if it doesn't exist --- USBNova.ino | 5 +++++ src/preferences/preferences.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/USBNova.ino b/USBNova.ino index 11f94a5..4689c3c 100644 --- a/USBNova.ino +++ b/USBNova.ino @@ -69,6 +69,11 @@ void setup() { if (!msc::exists(PREFERENCES_PATH)) { preferences::save(); } + + // Create main_script.txt if it doesn't exist yet + if (!msc::exists(preferences::getMainScript().c_str())) { + msc::write(preferences::getMainScript().c_str(), "# Hello World\n", 14); + } // Setup background tasks tasks::setCallback(update); diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index e91f840..5192097 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -36,7 +36,7 @@ namespace preferences { std::string default_layout { "US" }; int default_delay { 5 }; - std::string main_script { "main.script" }; + std::string main_script { "main_script.txt" }; int attack_color[4] { 128, 0, 0, 0 }; int setup_color[4] { 0, 0, 20, 0 }; @@ -215,7 +215,7 @@ namespace preferences { default_layout = "US"; default_delay = 5; - main_script = "main.script"; + main_script = "main_script.txt"; attack_color[0] = 128; attack_color[1] = 0;