-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added mkdir/rmdir support to file module. #3488
Added mkdir/rmdir support to file module. #3488
Conversation
components/modules/file.c
Outdated
const char *name = luaL_checkstring(L, 1); | ||
unsigned mode = luaL_optint(L, 2, 0777); | ||
int ret = mkdir(name, mode); | ||
if (ret != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know I'm not a firmware programmer 😉 but I'd write this like so:
if (mkdir(name, mode) != 0) {
return luaL_error(L, "failed to create directory '%s'; code %d", name, errno);
}
return 0;
- you use
if
/else
here but onlyif
infile_rmdir
(inconsistent style) - no need for the local
ret
variable {}
even for single lineif
blocks, seems consistent with the other code infile.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You keep claiming not to be one, yet the quality I've seen from you surpasses that of many a professional firmware programmer I've come across.
All fair points; I've updated accordingly, thanks.
Oh, and when you're ready, let's do the dev-esp32
-> dev-esp32-idf3-final
+ dev-esp32-idf4
-> dev-esp32
renames. As far as I'm aware the idf4 branch is production ready (or at least I hope so, seeing as we've been shipping devices based off it for a while at $work 😆).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and when you're ready, let's do the
dev-esp32
->dev-esp32-idf3-final
+dev-esp32-idf4
->dev-esp32
renames.
Oh absolutely, I am not opposed to that. The fact that neither marcelstoer/docker-nodemcu-build#101 nor marcelstoer/nodemcu-custom-build#41 are ready, doesn't mean the progress of this project should be held hostage.
a81c908
to
6ee4489
Compare
Somehow a year has already passed. @marcelstoer I'm going to both merge this and do the discussed branch renaming now; I've dawdled long enough, and I'm going to feel silly working on IDF5 support on a branch named IDF4 :D |
Thanks Johny. Can you also close the "migrate to IDF 4" tickets. IIRC there must be more than one. I am really out of touch with the development here. Hence, I might need some help with marcelstoer/docker-nodemcu-build#101 and marcelstoer/nodemcu-custom-build#41. Probably won't take long until the support emails start coming in now 😄 |
I don't see any such tickets here. Do you have a link? |
Looks like #3397 is the only one out of those labeled with "ESP32": https://github.com/nodemcu/nodemcu-firmware/issues?q=is%3Aopen+is%3Aissue+label%3AESP32 |
dev
branch rather than for therelease
branch.docs/*
.When working with SD cards formatting with FAT, having the ability to create and remove directories become important. This PR exposes the IDF's
mkdir
andrmdir
functions via thefile
module, since there is no standard Lua interface for it.