Skip to content

Commit 8ba09fa

Browse files
committed
removing complexity in certifications to gitbook
1 parent 8ac6e61 commit 8ba09fa

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/renderers/certifications_to_gitbook.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,22 @@ def is_url(item_path):
2323
return True
2424

2525

26+
def export_local_files(item_path, io_paths):
27+
""" Export local files to the new directory """
28+
if io_paths:
29+
output_path = os.path.join(io_paths['output'], 'artifacts', item_path)
30+
input_path = os.path.join(io_paths['input'], item_path)
31+
utils.create_dir(os.path.dirname(output_path))
32+
if not os.path.exists(output_path) or not filecmp.cmp(input_path, output_path):
33+
shutil.copy(input_path, output_path)
34+
35+
2636
def prepare_locally_stored_files(element, io_paths):
2737
""" Prepare the files by moving locally stored files to the `artifacts` directory
2838
and linking filepaths to that directory """
2939
item_path = element.get('path')
3040
if item_path and not is_url(item_path):
3141
element['path'] = os.path.join('/artifacts', item_path).replace('\\', '/')
32-
if io_paths:
33-
output_path = os.path.join(io_paths['output'], 'artifacts', item_path)
34-
input_path = os.path.join(io_paths['input'], item_path)
35-
utils.create_dir(os.path.dirname(output_path))
36-
if not os.path.exists(output_path) or not filecmp.cmp(input_path, output_path):
37-
shutil.copy(input_path, output_path)
3842

3943

4044
def convert_element(element, io_paths=None):

0 commit comments

Comments
 (0)