Fix atomicWrite non existing tmpold removal

This commit is contained in:
shortcutme 2019-03-27 03:12:02 +01:00
parent 9546ed0bb6
commit f8f857c820
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -23,7 +23,8 @@ def atomicWrite(dest, content, mode="wb"):
if os.path.isfile(dest): # Rename old file to -tmpold
os.rename(dest, dest + "-tmpold")
os.rename(dest + "-tmpnew", dest)
os.unlink(dest + "-tmpold") # Remove old file
if os.path.isfile(dest + "-tmpold"):
os.unlink(dest + "-tmpold") # Remove old file
return True
except Exception as err:
from Debug import Debug