From af3090e494c5bd14160ba180f8d1951135e9778f Mon Sep 17 00:00:00 2001
From: Calum Lind <calumlind+deluge@gmail.com>
Date: Sat, 28 May 2011 23:06:34 +0100
Subject: [PATCH] Fix errno18
---
deluge/plugins/autoadd/autoadd/core.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/deluge/plugins/autoadd/autoadd/core.py b/deluge/plugins/autoadd/autoadd/core.py
index bfea91e..ebac008 100644
|
a
|
b
|
def update_watchdir(self, watchdir_id):
|
| 263 | 263 | copy_torrent_path = watchdir['copy_torrent'] |
| 264 | 264 | log.debug("Moving added torrent file \"%s\" to \"%s\"", |
| 265 | 265 | os.path.basename(filepath), copy_torrent_path) |
| 266 | | os.rename( |
| 267 | | filepath, os.path.join(copy_torrent_path, filename) |
| 268 | | ) |
| | 266 | |
| | 267 | copy_torrent_file = os.path.join(copy_torrent_path, filename) |
| | 268 | try: |
| | 269 | os.rename(filepath, copy_torrent_file) |
| | 270 | except OSError, why: |
| | 271 | if why.errno == 18: |
| | 272 | from shutil import copyfile as shutil_copyfile |
| | 273 | shutil_copyfile(filepath, copy_torrent_file) |
| | 274 | os.remove(filepath) |
| | 275 | else: |
| | 276 | raise why |
| 269 | 277 | else: |
| 270 | 278 | os.remove(filepath) |
| 271 | 279 | |