Fixed a compatibility issue with force download default value setted to true under Windows.

This commit is contained in:
Alessandro Banfi 2015-03-17 22:27:20 +00:00
commit b646cef379

View file

@ -775,7 +775,15 @@ class CommandBase(object):
self.progress_text = '\nDone downloading.\n'
f.close()
os.rename(tmp_file, file_name)
try:
os.rename(tmp_file, file_name)
except OSError:
if sys.platform.startswith('win32') and not(os.path.isdir(file_name)):
os.remove(file_name)
os.rename(tmp_file, file_name)
else:
os.remove(tmp_file)
raise OSError
return self.continue_downloading_or_extract()