summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rwxr-xr-xmain.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/main.c b/main.c
index 8c5c9ac37..d206d4f16 100755
--- a/main.c
+++ b/main.c
@@ -181,7 +181,7 @@ void stop_mp(void) {
// Look for the first file that exists in the list of filenames, using mp_import_stat().
// Return its index. If no file found, return -1.
-const char* first_existing_file_in_list(const char ** filenames) {
+const char* first_existing_file_in_list(const char * const * filenames) {
for (int i = 0; filenames[i] != (char*)""; i++) {
mp_import_stat_t stat = mp_import_stat(filenames[i]);
if (stat == MP_IMPORT_STAT_FILE) {
@@ -191,7 +191,7 @@ const char* first_existing_file_in_list(const char ** filenames) {
return NULL;
}
-bool maybe_run_list(const char ** filenames, pyexec_result_t* exec_result) {
+bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec_result) {
const char* filename = first_existing_file_in_list(filenames);
if (filename == NULL) {
return false;
@@ -234,7 +234,8 @@ bool run_code_py(safe_mode_t safe_mode) {
if (autoreload_is_enabled()) {
serial_write_compressed(translate("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n"));
} else if (safe_mode != NO_SAFE_MODE) {
- serial_write_compressed(translate("Running in safe mode! Auto-reload is off.\n"));
+ serial_write_compressed(translate("Running in safe mode! "));
+ serial_write_compressed(translate("Auto-reload is off.\n"));
} else if (!autoreload_is_enabled()) {
serial_write_compressed(translate("Auto-reload is off.\n"));
}
@@ -250,25 +251,30 @@ bool run_code_py(safe_mode_t safe_mode) {
bool found_main = false;
if (safe_mode != NO_SAFE_MODE) {
- serial_write_compressed(translate("Running in safe mode! Not running saved code.\n"));
+ serial_write_compressed(translate("Running in safe mode! "));
+ serial_write_compressed(translate("Not running saved code.\n"));
} else {
new_status_color(MAIN_RUNNING);
- static const char *supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
- static const char *double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
+ static const char * const supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
+ #if CIRCUITPY_FULL_BUILD
+ static const char * const double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
"main.txt.py", "main.py.txt", "main.txt.txt","main.py.py");
+ #endif
stack_resize();
filesystem_flush();
supervisor_allocation* heap = allocate_remaining_memory();
start_mp(heap);
found_main = maybe_run_list(supported_filenames, &result);
+ #if CIRCUITPY_FULL_BUILD
if (!found_main){
found_main = maybe_run_list(double_extension_filenames, &result);
if (found_main) {
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
}
}
+ #endif
cleanup_after_vm(heap);
if (result.return_code & PYEXEC_FORCED_EXIT) {
@@ -337,7 +343,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
// If not in safe mode, run boot before initing USB and capture output in a
// file.
if (filesystem_present() && safe_mode == NO_SAFE_MODE && MP_STATE_VM(vfs_mount_table) != NULL) {
- static const char *boot_py_filenames[] = STRING_LIST("settings.txt", "settings.py", "boot.py", "boot.txt");
+ static const char * const boot_py_filenames[] = STRING_LIST("settings.txt", "settings.py", "boot.py", "boot.txt");
new_status_color(BOOT_RUNNING);