Mercurial > gcp
comparison gcp @ 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 | 7b303c41b273 |
comparison
equal
deleted
inserted
replaced
46:dda2195dc9f4 | 47:99da6ef26d26 |
---|---|
309 """Take the last file in the list, and launch the copy using glib io_watch event | 309 """Take the last file in the list, and launch the copy using glib io_watch event |
310 @return: True a file was added, False else""" | 310 @return: True a file was added, False else""" |
311 if self.copy_list: | 311 if self.copy_list: |
312 source_file, dest_path, options = self.copy_list.pop() | 312 source_file, dest_path, options = self.copy_list.pop() |
313 self.journal.startFile(source_file) | 313 self.journal.startFile(source_file) |
314 source_fd = open(source_file, 'rb') | 314 try: |
315 source_fd = open(source_file, 'rb') | |
316 except: | |
317 self.journal.copyFailed() | |
318 self.journal.error("can't open source") | |
319 self.journal.closeFile() | |
320 source_fd.close() | |
321 return True | |
315 filename = os.path.basename(source_file) | 322 filename = os.path.basename(source_file) |
316 assert(filename) | 323 assert(filename) |
317 dest_file = self.__filename_fix(options.dest_file,options) if options.dest_file else self.__filename_fix(os.path.join(dest_path,filename),options) | 324 dest_file = self.__filename_fix(options.dest_file,options) if options.dest_file else self.__filename_fix(os.path.join(dest_path,filename),options) |
318 if os.path.exists(dest_file) and not options.force: | 325 if os.path.exists(dest_file) and not options.force: |
319 warning (_("File [%s] already exists, skipping it !") % dest_file.decode('utf-8','replace')) | 326 warning (_("File [%s] already exists, skipping it !") % dest_file.decode('utf-8','replace')) |