mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 15:38:43 +00:00
This commit is contained in:
parent
efd2762255
commit
93091fbe23
2 changed files with 9 additions and 5 deletions
|
@ -591,7 +591,7 @@ def utf8_encoded(s):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if isinstance(s, str):
|
if isinstance(s, str):
|
||||||
s = decode_string(s, locale.getpreferredencoding())
|
s = decode_string(s)
|
||||||
elif isinstance(s, unicode):
|
elif isinstance(s, unicode):
|
||||||
s = s.encode("utf8", "ignore")
|
s = s.encode("utf8", "ignore")
|
||||||
return s
|
return s
|
||||||
|
|
|
@ -793,16 +793,20 @@ 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"""
|
||||||
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:
|
||||||
# Try to make the destination path if it doesn't exist
|
# Try to make the destination path if it doesn't exist
|
||||||
os.makedirs(dest)
|
os.makedirs(dest_u)
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
log.exception(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
|
return False
|
||||||
try:
|
try:
|
||||||
self.handle.move_storage(dest.encode("utf8"))
|
self.handle.move_storage(dest_u)
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue