Added the rename method to the module uos - #2082
Conversation
|
Thanks for your patch! Unfortunately, its commit message don't follow the project conventions. These are described in https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md , and you were presented link to this document when you prepared this pull request (via https://github.com/micropython/micropython/blob/master/CONTRIBUTING.md document, which contains links to other important information). Before the patch can be merged, the commit message(s) should be fixed. We encourage you to do this on your side (via git interactive rebase features, The project codebase receives high praises for its quality and cleanliness, that was enables us (contributors) to easily prepare patches for it. Let's make sure that after our contributions, the codebase stays clean as before! Thanks! |
|
Hi Paul. I tried to follow you suggestions, but got screwed up by git. I think I'll wait. |
That one was missing in the module, even if it was available in the
vfs object. The change consist of adding the name and preparing the
call to the underlying vfs module, similar to what was already
implemented e.g. for remove.
Rename is useful by itself, or for instance for a safe file replace,
consisting of the sequence:
write to a temp file
delete the original file
rename the temp file to the original file's name
|
As far as I can see, everything is ok. And thanks for trying it (otherwise can be seen just as a reminder for next time ;-) ). |
|
Merged, thanks! Any other missing method is of course not on purpose, but an omission. Feel free to report them/submit patches too. |
|
Hello Paul, is it worth a change to add aliases of remove named unlink and rmdir to Regards, Robert On 16.05.2016 14:25, Paul Sokolovsky wrote:
|
Nope, I don't think it needs to be added, unless there's a specific reason to add it, and I can't think of one where reply "user remove() instead" wouldn't work. Feel free to share if you have one.
Is a different case, it POSIX OS (and thus in Python), you can't delete a directory with remove(), it should be proper rmdir(), whcih is probably not exposed in FatFs VFS object yet at all. I'm not sure if you hint that with FatFS, remove() can remove a dir though. If so, as a quick fix, we can make rmdir() be an alias to remove() indeed. |
|
Hello Paul, I made a trial coding of chdir(), by just copying in the code from the Nothing of that is important, and since the policy of the ESP8266 port On 18.05.2016 22:28, Paul Sokolovsky wrote:
|
writeto_then_readfrom has been added to do a write -> no stop -> repeated start -> read sequence. This is done to match the capabilities of Blinka on Linux. Code that uses stop=False will not work correctly on Blinka. To fix, if stop=False then use writeto_then_readfrom otherwise use writeto then readfrom_into. First step in micropython#2082
esp8266/moduos.c: Addition of the rename method to module uos.
That one was missing in the module, even if it was available in the vfs object. The change consist of adding the name and preparing the call to the underlying vfs module, similar to what was already implemented e.g. for remove.
Rename is useful by itself, or for instance for a safe file replace, consisting of the sequence: