support for doubled file extensions ala issue #383#415
Conversation
| maybe_run("code.py", &result) || | ||
| maybe_run("main.py", &result) || | ||
| maybe_run("main.txt", &result); | ||
| const char *supported_filenames[] = {"code.txt", "code.py", "main.py", "main.txt",""}; |
There was a problem hiding this comment.
How about adding a macro to do this initialization? That way it can add the empty string.
STRING_LIST("code.txt", "code.py", "main.py", "main.txt")
There was a problem hiding this comment.
I don't see a place for similar macros like supervisor/default/messages.h is for message strings. Should I put it in main.c or somewhere else?
There was a problem hiding this comment.
In this file is fine. I'd probably just put it above maybe_run_list.
| return false; | ||
| bool maybe_run_list(const char ** filenames, pyexec_result_t* exec_result) { | ||
|
|
||
| for (int i = 0; *(filenames[i]); i++) { |
There was a problem hiding this comment.
Implicit C int -> bool confuses my C++ and python brain. Mind making this filenames[i] != ""?
There was a problem hiding this comment.
I agree, that would be easier to read.
|
I made the changes and pushed. |
tannewt
left a comment
There was a problem hiding this comment.
Looks good! Thanks for fixing this up!
Here's my fix. It's the first C I've written in quite a long time so by all means suggest any improvements that are warranted.