Improved configuration to handle absolute paths in add_json_file
This commit is contained in:
parent
fe5c41ac09
commit
a95d6e7f8a
@ -285,14 +285,17 @@ class Configuration(ConfigurationABC):
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
|
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
|
||||||
path_root = self._application_environment.working_directory
|
if os.path.isabs(name):
|
||||||
if path is not None:
|
file_path = name
|
||||||
path_root = path
|
|
||||||
|
|
||||||
if str(path_root).endswith('/') and not name.startswith('/'):
|
|
||||||
file_path = f'{path_root}{name}'
|
|
||||||
else:
|
else:
|
||||||
file_path = f'{path_root}/{name}'
|
path_root = self._application_environment.working_directory
|
||||||
|
if path is not None:
|
||||||
|
path_root = path
|
||||||
|
|
||||||
|
if str(path_root).endswith('/') and not name.startswith('/'):
|
||||||
|
file_path = f'{path_root}{name}'
|
||||||
|
else:
|
||||||
|
file_path = f'{path_root}/{name}'
|
||||||
|
|
||||||
if not os.path.isfile(file_path):
|
if not os.path.isfile(file_path):
|
||||||
if optional is not True:
|
if optional is not True:
|
||||||
|
Loading…
Reference in New Issue
Block a user