From acbe4418bb84508d146ba748784931c5a018cfc4 Mon Sep 17 00:00:00 2001 From: Jelle Teijema Date: Fri, 13 Dec 2024 15:35:31 -0800 Subject: [PATCH] refactor projectpaths class --- asreviewcontrib/makita/entrypoint.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/asreviewcontrib/makita/entrypoint.py b/asreviewcontrib/makita/entrypoint.py index cb2ea78..cbfb508 100644 --- a/asreviewcontrib/makita/entrypoint.py +++ b/asreviewcontrib/makita/entrypoint.py @@ -266,7 +266,7 @@ def _setup_project_folder(self): paths = ProjectPaths( project_folder=project_folder, job_file=self.args.job_file, - platform=self.args.platform + platform=self.args.platform, ) paths.output_folder_path.mkdir(parents=True, exist_ok=True) @@ -333,6 +333,15 @@ class ProjectPaths: job_file: str = None platform: str = None + def __post_init__(self): + if self.job_file is None: + if self.platform == "Windows" or ( + self.platform is None and os.name == "nt" + ): + self.job_file = "jobs.bat" + else: + self.job_file = "jobs.sh" + @property def output_folder_path(self): return self.project_folder / self.output_folder @@ -347,12 +356,4 @@ def scripts_folder_path(self): @property def job_file_path(self): - return self.project_folder / (self.job_file or self._get_job_file_name()) - - def _get_job_file_name(self): - """Determine the job file name based on the platform.""" - if self.platform == "Windows" or ( - self.platform is None and os.name == "nt" - ): - return "jobs.bat" - return "jobs.sh" + return self.project_folder / self.job_file