Fix atomicWrite non existing tmpold removal
This commit is contained in:
parent
9546ed0bb6
commit
f8f857c820
1 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,8 @@ def atomicWrite(dest, content, mode="wb"):
|
||||||
if os.path.isfile(dest): # Rename old file to -tmpold
|
if os.path.isfile(dest): # Rename old file to -tmpold
|
||||||
os.rename(dest, dest + "-tmpold")
|
os.rename(dest, dest + "-tmpold")
|
||||||
os.rename(dest + "-tmpnew", dest)
|
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
|
return True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
from Debug import Debug
|
from Debug import Debug
|
||||||
|
|
Loading…
Reference in a new issue