mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 13:05:37 +00:00
[#2703] [Core] Stop moving files if target files exist
This commit is contained in:
parent
244ae878c9
commit
560318a5a7
@ -855,13 +855,16 @@ class Torrent(object):
|
||||
log.error("Could not move storage for torrent %s since %s does not exist and could not create the directory.", self.torrent_id, dest_u)
|
||||
return False
|
||||
|
||||
kwargs = {}
|
||||
if deluge.common.VersionSplit(lt.version) >= deluge.common.VersionSplit("1.0.0.0"):
|
||||
kwargs['flags'] = 1 # fail_if_exist
|
||||
dest_bytes = dest.encode('utf-8')
|
||||
try:
|
||||
# libtorrent needs unicode object if wstrings are enabled, utf8 bytestring otherwise
|
||||
try:
|
||||
self.handle.move_storage(dest)
|
||||
self.handle.move_storage(dest, **kwargs)
|
||||
except TypeError:
|
||||
self.handle.move_storage(dest_bytes)
|
||||
self.handle.move_storage(dest_bytes, **kwargs)
|
||||
except Exception, e:
|
||||
log.error("Error calling libtorrent move_storage: %s" % e)
|
||||
return False
|
||||
|
@ -1064,6 +1064,7 @@ class TorrentManager(component.Component):
|
||||
except (RuntimeError, KeyError):
|
||||
return
|
||||
|
||||
log.error("Torrent %s, %s", torrent_id, decode_string(alert.message()))
|
||||
if torrent_id in self.waiting_on_finish_moving:
|
||||
self.waiting_on_finish_moving.remove(torrent_id)
|
||||
torrent.is_finished = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user