diff options
author | emkael <emkael@tlen.pl> | 2018-02-23 16:12:50 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-02-23 16:12:50 +0100 |
commit | 17cd057a947772e04fa2ab731b87b1f4fff52da5 (patch) | |
tree | a9800bc1a6d70342b4c28135154668ba4a421e52 /jfr_playoff | |
parent | 320868f72185630b59cc690e81fbb1f76e92075b (diff) |
Creating output directories if they don't exist
Fixes #18
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/filemanager.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jfr_playoff/filemanager.py b/jfr_playoff/filemanager.py index e60976b..6392ac9 100644 --- a/jfr_playoff/filemanager.py +++ b/jfr_playoff/filemanager.py @@ -25,6 +25,9 @@ class PlayoffFileManager(object): self.files.add(path.replace(self.output_path, '')) def write_content(self, content): + output_dir = os.path.dirname(self.output_file) + if not os.path.exists(output_dir): + os.makedirs(output_dir) output = open(self.output_file, 'w') output.write(content.encode('utf8')) output.close() @@ -33,6 +36,9 @@ class PlayoffFileManager(object): def copy_scripts(self, script_path='sklady/playoff.js'): script_output_path = os.path.join(self.output_path, script_path) + script_output_dir = os.path.dirname(script_output_path) + if not os.path.exists(script_output_dir): + os.makedirs(script_output_dir) shutil.copy( unicode(os.path.join( os.path.dirname(__main__.__file__), 'playoff.js')), |