mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 16:46:21 +00:00
backport: removal of files on Windows before --revert and conversion file rename
Windows won't allow a rename to overwrite an existing file (without Error 183, file already exists).
This commit is contained in:
parent
8b0bce5d15
commit
2fc24bf8aa
@ -2098,6 +2098,8 @@ if __name__ == '__main__':
|
||||
elif revert:
|
||||
print "wmllint: reverting %s" % backup
|
||||
if not dryrun:
|
||||
if sys.platform == 'win32':
|
||||
os.remove(fn)
|
||||
os.rename(backup, fn)
|
||||
elif diffs:
|
||||
# Display diffs
|
||||
@ -2116,6 +2118,8 @@ if __name__ == '__main__':
|
||||
if changed:
|
||||
print "wmllint: converting", fn
|
||||
if not dryrun:
|
||||
if sys.platform == 'win32' and os.path.exists(backup):
|
||||
os.remove(backup)
|
||||
os.rename(fn, backup)
|
||||
ofp = open(fn, "w")
|
||||
ofp.write(changed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user