mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Attempt to create a move_storage destination path if it doesn't exist
This commit is contained in:
parent
72ec926c1a
commit
d793b9e6b8
1 changed files with 7 additions and 2 deletions
|
@ -795,8 +795,13 @@ 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):
|
if not os.path.exists(dest):
|
||||||
log.error("Could not move storage for torrent %s since %s does not exist!", self.torrent_id, dest)
|
try:
|
||||||
return False
|
# Try to make the destination path if it doesn't exist
|
||||||
|
os.makedirs(dest)
|
||||||
|
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)
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
self.handle.move_storage(dest.encode("utf8"))
|
self.handle.move_storage(dest.encode("utf8"))
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue