mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Fix renaming folders on libtorrent 0.16 compiled with unicode support (Windows)
This commit is contained in:
parent
b08573831e
commit
36d8c5517f
1 changed files with 8 additions and 4 deletions
|
@ -852,10 +852,10 @@ class Torrent(object):
|
||||||
def move_storage(self, dest):
|
def move_storage(self, dest):
|
||||||
"""Move a torrent's storage location"""
|
"""Move a torrent's storage location"""
|
||||||
try:
|
try:
|
||||||
dest = unicode(dest, "utf-8")
|
dest = unicode(dest, "utf-8")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# String is already unicode
|
# String is already unicode
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not os.path.exists(dest):
|
if not os.path.exists(dest):
|
||||||
try:
|
try:
|
||||||
|
@ -986,7 +986,11 @@ class Torrent(object):
|
||||||
if f["path"].startswith(folder):
|
if f["path"].startswith(folder):
|
||||||
# Keep track of filerenames we're waiting on
|
# Keep track of filerenames we're waiting on
|
||||||
wait_on_folder[f["index"]] = Deferred().addBoth(on_file_rename_complete, wait_on_folder, f["index"])
|
wait_on_folder[f["index"]] = Deferred().addBoth(on_file_rename_complete, wait_on_folder, f["index"])
|
||||||
self.handle.rename_file(f["index"], f["path"].replace(folder, new_folder, 1).encode("utf-8"))
|
new_path = f["path"].replace(folder, new_folder, 1)
|
||||||
|
try:
|
||||||
|
self.handle.rename_file(f["index"], new_path)
|
||||||
|
except TypeError:
|
||||||
|
self.handle.rename_file(f["index"], new_path.encode("utf-8"))
|
||||||
|
|
||||||
def on_folder_rename_complete(result, torrent, folder, new_folder):
|
def on_folder_rename_complete(result, torrent, folder, new_folder):
|
||||||
component.get("EventManager").emit(TorrentFolderRenamedEvent(torrent.torrent_id, folder, new_folder))
|
component.get("EventManager").emit(TorrentFolderRenamedEvent(torrent.torrent_id, folder, new_folder))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue