Skip to content

Change Android mv() back to using the system renameTo() method. #46

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

Merged
merged 1 commit into from
Jul 1, 2021

Conversation

pcardon
Copy link
Collaborator

@pcardon pcardon commented Jun 26, 2021

A previous change to rn-fetch-blob's mv implementation entailed copying the source file to the destination file and then deleting the source file. This approach has an undesirable impact on the mv operation, where the operation takes orders of magnitude longer to complete. It also adds disk space requirements that shouldn't be necessary, since both files need to exist at the same time.
This change goes back to using the renameTo() method, while adding some extra error checking to hopefully alleviate whatever problems caused the original fix.
Note that the POSIX mv() and rename() methods both stipulate that moving to a non-existent directory should be treated as an error.

A previous change to rn-fetch-blob's mv implementation entailed copying the source file to the destination file and then deleting the source file.  This approach has an undesirable impact on the mv operation, where the operation takes orders of magnitude longer to complete.  It also adds disk space requirements that shouldn't be necessary, since both files need to exist at the same time.
This change goes back to using the renameTo() method, while adding some extra error checking to hopefully alleviate whatever problems caused the original fix.
Note that the POSIX mv() and rename() methods both stipulate that moving to a non-existent directory should be treated as an error.
@RonRadtke
Copy link
Owner

Can't find the original issue anymore either.
You tested your changes @pcardon ?

@pcardon
Copy link
Collaborator Author

pcardon commented Jun 29, 2021

Yes. Our team has been using this code for at least a year.

@RonRadtke RonRadtke merged commit a9af868 into RonRadtke:master Jul 1, 2021
@pcardon
Copy link
Collaborator Author

pcardon commented Jul 22, 2021

Thanks for the merges, Ron. I'm happy to help with other issues. Let's talk some time about how I could help.

@RonRadtke
Copy link
Owner

@pcardon thank you very much for the offer! Feel free to contact me. Best you just send me a mail to dev@ikascripts.de

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants