From c58221c866e65b43ee03db83db51aad776a6f7a6 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Mon, 11 Feb 2013 21:36:46 -0500 Subject: [PATCH] Fix renaming folders on libtorrent 0.16 compiled with unicode support (Windows) --- deluge/core/torrent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index f2403a67e..895fd6240 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -960,7 +960,11 @@ class Torrent(object): if f["path"].startswith(folder): # Keep a list of filerenames we're waiting on wait_on_folder[2].append(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")) self.waiting_on_folder_rename.append(wait_on_folder) def cleanup_prev_status(self):