summaryrefslogtreecommitdiff
path: root/jfr_playoff/filemanager.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-30 14:34:41 +0200
committeremkael <emkael@tlen.pl>2019-07-30 14:34:41 +0200
commit70edb40abe7253d7faede7080e6945aec569753e (patch)
tree4dc7c38c9b78a2f683c7689274160e451bde1538 /jfr_playoff/filemanager.py
parentc4b1705710d268f17b21c9547c510272a2acaba4 (diff)
Missing resources handled as a readable error
Diffstat (limited to 'jfr_playoff/filemanager.py')
-rw-r--r--jfr_playoff/filemanager.py10
1 files changed, 6 insertions, 4 deletions
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