diff options
author | Andrew Resch <andrewresch@gmail.com> | 2010-07-15 10:50:15 -0700 |
---|---|---|
committer | Andrew Resch <andrewresch@gmail.com> | 2010-07-15 10:50:15 -0700 |
commit | d793b9e6b8e4fabb78175a9b5d0d137ee8da98fb (patch) | |
tree | d2ddafc1d12a46f3f392a879a4f1895f1a5329b1 | |
parent | 72ec926c1afdb312ad51dfbbac117c1775abfdb6 (diff) | |
download | deluge-d793b9e6b8e4fabb78175a9b5d0d137ee8da98fb.tar.gz deluge-d793b9e6b8e4fabb78175a9b5d0d137ee8da98fb.tar.bz2 deluge-d793b9e6b8e4fabb78175a9b5d0d137ee8da98fb.zip |
Attempt to create a move_storage destination path if it doesn't exist
-rw-r--r-- | deluge/core/torrent.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index dc569c5f8..692466328 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -795,8 +795,13 @@ class Torrent(object): def move_storage(self, dest): """Move a torrent's storage location""" if not os.path.exists(dest): - log.error("Could not move storage for torrent %s since %s does not exist!", self.torrent_id, dest) - return False + try: + # 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: self.handle.move_storage(dest.encode("utf8")) except: |