changeset 47:99da6ef26d26

fixed crash when source file can't be opened
author Goffi <goffi@goffi.org>
date Sat, 04 Jun 2011 20:58:36 +0200
parents dda2195dc9f4
children d26ffbbcbdad
files gcp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gcp	Sat Jun 04 20:55:44 2011 +0200
+++ b/gcp	Sat Jun 04 20:58:36 2011 +0200
@@ -311,7 +311,14 @@
         if self.copy_list:
             source_file, dest_path, options = self.copy_list.pop()
             self.journal.startFile(source_file)
-            source_fd = open(source_file, 'rb')
+            try:
+                source_fd = open(source_file, 'rb')
+            except:
+                self.journal.copyFailed()
+                self.journal.error("can't open source")
+                self.journal.closeFile()
+                source_fd.close()
+                return True
             filename = os.path.basename(source_file)
             assert(filename)
             dest_file = self.__filename_fix(options.dest_file,options) if options.dest_file else self.__filename_fix(os.path.join(dest_path,filename),options)