Skip to content

Commit

Permalink
Fix creation of python server file
Browse files Browse the repository at this point in the history
  • Loading branch information
GJFR committed Nov 15, 2024
1 parent 301da7e commit cf43c7d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bci/evaluations/custom/custom_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,17 @@ def add_page(self, project: str, poc: str, domain: str, path: str, file_type: st
domain_path = os.path.join(Global.custom_page_folder, project, poc, domain)
if not os.path.exists(domain_path):
os.makedirs(domain_path)
page_path = os.path.join(domain_path, path)
if not os.path.exists(page_path):
os.makedirs(page_path)
new_file_name = f'index.{file_type}'
file_path = os.path.join(page_path, new_file_name)

if file_type == 'py':
file_name = path if path.endswith('.py') else path + '.py'
file_path = os.path.join(domain_path, file_name)
else:
page_path = os.path.join(domain_path, path)
if not os.path.exists(page_path):
os.makedirs(page_path)
new_file_name = f'index.{file_type}'
file_path = os.path.join(page_path, new_file_name)

if os.path.exists(file_path):
return False
with open(file_path, 'w') as file:
Expand Down

0 comments on commit cf43c7d

Please sign in to comment.