timendum / raiplaysound

GNU General Public License v3.0
29 stars 11 forks source link

atomic write #17

Closed boyska closed 9 months ago

boyska commented 9 months ago

This is better suited to be served directly. In fact, it avoids the file ever being in an inconsistent state. Code complexity is only increased by a little bit.

timendum commented 9 months ago

I get a FileExistsError the second time this runs, but I want to overwrite previous version of xml files.

It's because os.rename raise this error on windows. Maybe os.replace is better?

boyska commented 9 months ago

I get a FileExistsError the second time this runs, but I want to overwrite previous version of xml files.

It's because os.rename raise this error on windows. Maybe os.replace is better?

thanks for spotting this! indeed the semantic is a bit different between UNIX and windows. I fixed that in 148169116d2bc0345b5dca571bcae10c477f1a36

timendum commented 9 months ago

Thanks! Merged

AvverbioPronome commented 9 months ago

note that this changed file permissions, see https://github.com/AvverbioPronome/raiplaysound/actions/runs/7421072015