fileutils.replace: bak file for win32 ReplaceFile for slightly better corner case coverage on less featureful filesystems

This commit is contained in:
Mahmoud Hashemi 2016-02-25 01:47:02 -08:00
parent 8899811905
commit 225d98f68f
1 changed files with 3 additions and 2 deletions

View File

@ -258,8 +258,9 @@ if os.name == 'nt':
src = path_to_unicode(src) src = path_to_unicode(src)
dst = path_to_unicode(dst) dst = path_to_unicode(dst)
res = _ReplaceFile(c_wchar_p(dst), c_wchar_p(src), bak = dst + u'.bak'
None, 0, None, None) res = _ReplaceFile(c_wchar_p(dst), c_wchar_p(src), c_wchar_p(bak),
0, None, None)
if not res: if not res:
raise OSError('failed to replace %r with %r' % (dst, src)) raise OSError('failed to replace %r with %r' % (dst, src))
return return