Fix renaming of .tmp files on Windows
On Windows, you can't rename over a file that exists, and you can't delete a file you stil have open. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This commit is contained in:
parent
8f4860f1d9
commit
cce41cbd3f
@ -197,6 +197,7 @@ If you want to contribute changes to a resolvers list, only edit files from the
|
|||||||
else:
|
else:
|
||||||
with open(md_path + ".tmp", "wt") as f:
|
with open(md_path + ".tmp", "wt") as f:
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
os.unlink(md_path)
|
||||||
os.rename(md_path + ".tmp", md_path)
|
os.rename(md_path + ".tmp", md_path)
|
||||||
|
|
||||||
# Legacy
|
# Legacy
|
||||||
@ -214,7 +215,8 @@ If you want to contribute changes to a resolvers list, only edit files from the
|
|||||||
else:
|
else:
|
||||||
with open(md_legacy_path + ".tmp", "wt") as f:
|
with open(md_legacy_path + ".tmp", "wt") as f:
|
||||||
f.write(out_legacy)
|
f.write(out_legacy)
|
||||||
os.rename(md_legacy_path + ".tmp", md_legacy_path)
|
os.unlink(md_legacy_path)
|
||||||
|
os.rename(md_legacy_path + ".tmp", md_legacy_path)
|
||||||
|
|
||||||
# Historic
|
# Historic
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user