[#2703] [Core] Stop moving files if target files exist

This commit is contained in:
Calum Lind 2015-09-29 23:31:23 +01:00
parent 7f2e06d4e2
commit 0838202892

View File

@ -1089,10 +1089,11 @@ class Torrent(object):
try:
# libtorrent needs unicode object if wstrings are enabled, utf8 bytestring otherwise
# Keyword argument flags=1 (fail_if_exist) stops overwriting of target files.
try:
self.handle.move_storage(dest)
self.handle.move_storage(dest, flags=1)
except TypeError:
self.handle.move_storage(utf8_encoded(dest))
self.handle.move_storage(utf8_encoded(dest), flags=1)
except RuntimeError as ex:
log.error("Error calling libtorrent move_storage: %s", ex)
return False