From 70edb40abe7253d7faede7080e6945aec569753e Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 30 Jul 2019 14:34:41 +0200 Subject: Missing resources handled as a readable error --- jfr_playoff/filemanager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/filemanager.py b/jfr_playoff/filemanager.py index 990b9f2..3a6c19e 100644 --- a/jfr_playoff/filemanager.py +++ b/jfr_playoff/filemanager.py @@ -51,6 +51,11 @@ class PlayoffFileManager(object): return self.output_file def copy_file(self, filename, path): + source_path = unicode(os.path.join( + os.path.dirname(__main__.__file__), filename)) + if not os.path.exists(source_path): + raise IOError('File: %s missing from runtime directory' % ( + filename)) output_path = os.path.join(self.output_path, path) output_dir = os.path.dirname(output_path) if len(output_dir) > 0: @@ -61,10 +66,7 @@ class PlayoffFileManager(object): os.makedirs(output_dir) PlayoffLogger.get('filemanager').info( 'copying file to %s', output_path) - shutil.copy( - unicode(os.path.join( - os.path.dirname(__main__.__file__), filename)), - unicode(output_path)) + shutil.copy(source_path, unicode(output_path)) self.register_file(output_path) return output_path -- cgit v1.2.3