Improved application environment

This commit is contained in:
Sven Heidemann 2021-04-07 18:06:07 +02:00
parent 76a6ba11fb
commit dc849c4f71
2 changed files with 24 additions and 11 deletions

View File

@ -81,18 +81,22 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
@property @property
def working_directory(self) -> str: def working_directory(self) -> str:
return self._working_directory return str(self._working_directory)
def set_working_directory(self, path: str = ''):
if path != '':
self._working_directory = path
return
self._working_directory = pathlib.Path().absolute()
@property @property
def runtime_directory(self) -> str: def runtime_directory(self) -> str:
return self._runtime_directory return str(self._runtime_directory)
def set_runtime_directory(self, file: str): def set_runtime_directory(self, runtime_directory: str):
self._runtime_directory = pathlib.Path(file).parent.absolute() if runtime_directory != '':
self._runtime_directory = runtime_directory
return
self._runtime_directory = pathlib.Path().absolute()
def set_working_directory(self, working_directory: str):
if working_directory != '':
self._working_directory = working_directory
return
self._working_directory = pathlib.Path().absolute()

View File

@ -83,3 +83,12 @@ class ApplicationEnvironmentABC(ABC):
:return: :return:
""" """
pass pass
@abstractmethod
def set_working_directory(self, working_directory: str):
"""
Sets the current working directory
:param working_directory:
:return:
"""
pass