kylebebak / Requester

Powerful, modern HTTP/REST client built on top of the Requests library
https://kylebebak.github.io/Requester/
MIT License
307 stars 10 forks source link

fix rename backup history file #30 #32

Open mercurykd opened 3 years ago

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.2%) to 70.608% when pulling 6c2ec64660def187d35c31efee386159a233458f on mercurykd:issue-30 into 93fd2673cf69a97b0e0d49a2411abe6148326f41 on kylebebak:master.

kylebebak commented 3 years ago

What issue does this fix?

I can create files a.txt and b.txt in the same directory, and calling os.rename("a.txt", "b.txt") overwrites the content of b.txt with that of a.txt.

In other words, this code works as expected. Your PR tries to remove the backup file before renaming the main file to the backup file. I don't see what that could achieve.

mercurykd commented 3 years ago

What issue does this fix?

I can create files a.txt and b.txt in the same directory, and calling os.rename("a.txt", "b.txt") overwrites the content of b.txt with that of a.txt.

Then why does the error occur? FileExistsError: [WinError 183] The file cannot be created because it already exists: 'C:\Users\User\AppData\Roaming\Sublime Text 3\Packages\User\Requester.history.json.bkp'