Module: deluge
Branch: 1.3-stable
Commit: c95ca18b37eba0ba9aa0c61e0ce68b2ac6ef18aa

Author: Calum Lind <[email protected]>
Date:   Thu Jun 16 19:19:12 2011 +0100

Add a file exists check to torrents passed as arg

---

 deluge/ui/gtkui/ipcinterface.py   |    4 ++++
 deluge/ui/gtkui/queuedtorrents.py |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py
index 57afd24..b7837d1 100644
--- a/deluge/ui/gtkui/ipcinterface.py
+++ b/deluge/ui/gtkui/ipcinterface.py
@@ -219,6 +219,10 @@ def process_args(args):
         else:
             # Just a file
             log.debug("Attempting to add %s from external source..", arg)
+            if not os.path.exists(arg):
+                log.error("No such file: %s", arg)
+                continue
+
             if config["interactive_add"]:
                 component.get("AddTorrentDialog").add_from_files([arg])
                 
component.get("AddTorrentDialog").show(config["focus_add_dialog"])
diff --git a/deluge/ui/gtkui/queuedtorrents.py 
b/deluge/ui/gtkui/queuedtorrents.py
index fa18a1f..adddccd 100644
--- a/deluge/ui/gtkui/queuedtorrents.py
+++ b/deluge/ui/gtkui/queuedtorrents.py
@@ -190,6 +190,10 @@ class QueuedTorrents(component.Component):
                 else:
                     client.core.add_magnet_uris([torrent_path], [])
             else:
+                if not os.path.exists(torrent_path):
+                    log.error("No such file: %s", torrent_path)
+                    return
+
                 if self.config["interactive_add"]:
                     def on_show(result):
                         
component.get("AddTorrentDialog").add_from_files([torrent_path])

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to