summaryrefslogtreecommitdiffstats
path: root/deluge/core/torrent.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2011-02-02 01:25:17 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2011-02-05 01:12:43 +0000
commit417a9f6e63e75e5c8b5c2cd9e922aea1723c50de (patch)
treec0760020ce27149b86b9767f21a8a1354926288b /deluge/core/torrent.py
parentba6389bcac928fa6ea814d22ebb1a94ab19880a0 (diff)
downloaddeluge-417a9f6e63e75e5c8b5c2cd9e922aea1723c50de.tar.gz
deluge-417a9f6e63e75e5c8b5c2cd9e922aea1723c50de.tar.bz2
deluge-417a9f6e63e75e5c8b5c2cd9e922aea1723c50de.zip
Fix #1373, #1386 - Creating and moving non-ascii folder names in MS Windows
Diffstat (limited to 'deluge/core/torrent.py')
-rw-r--r--deluge/core/torrent.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 9c09f5231..a1a2bdd27 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -807,16 +807,20 @@ class Torrent(object):
def move_storage(self, dest):
"""Move a torrent's storage location"""
- if not os.path.exists(dest):
+
+ # Convert path from utf8 to unicode
+ dest_u=unicode(dest,"utf-8")
+
+ if not os.path.exists(dest_u):
try:
# Try to make the destination path if it doesn't exist
- os.makedirs(dest)
+ os.makedirs(dest_u)
except IOError, e:
log.exception(e)
- log.error("Could not move storage for torrent %s since %s does not exist and could not create the directory.", self.torrent_id, dest)
+ 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
try:
- self.handle.move_storage(dest.encode("utf8"))
+ self.handle.move_storage(dest_u)
except:
return False