From faa7e701fddfaebe3ae70130d2e5ff91294bcef3 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 11 Apr 2021 14:21:59 +0200 Subject: [PATCH] Fixed workspace loading error for update command --- src/cpl_cli/command_handler_service.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/cpl_cli/command_handler_service.py b/src/cpl_cli/command_handler_service.py index 13e850a2..62d0c73c 100644 --- a/src/cpl_cli/command_handler_service.py +++ b/src/cpl_cli/command_handler_service.py @@ -62,20 +62,14 @@ class CommandHandler(ABC): if command.is_project_needed: name = os.path.basename(self._env.working_directory) - project_path = os.path.join( - self._env.working_directory, - f'{name}.json' - ) - project_path_camel_case = os.path.join( - self._env.working_directory, - f'{String.convert_to_camel_case(name)}.json' - ) - - if os.path.isfile(project_path): - project_name = os.path.basename(self._env.working_directory) - - if os.path.isfile(project_path_camel_case): - project_name = String.convert_to_camel_case(name) + for r, d, f in os.walk(self._env.working_directory): + for file in f: + if file.endswith('.json'): + f_name = file.split('.json')[0] + if f_name == name or \ + String.convert_to_camel_case(f_name) == String.convert_to_camel_case(name): + project_name = f_name + break if not command.is_workspace_needed and project_name is None and workspace is None: self._project_not_found()