Skip to content

Commit

Permalink
Config path now undergoes tilde expansion and env var expansion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiannis128 committed Feb 3, 2024
1 parent bb09c45 commit e6044fa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions esbmc_ai/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ def get_env_vars() -> None:
)

global cfg_path
cfg_path = str(os.getenv("ESBMC_AI_CFG_PATH"))
cfg_path = os.path.expanduser(
os.path.expandvars(str(os.getenv("ESBMC_AI_CFG_PATH")))
)


def _load_ai_data(config: dict) -> None:
Expand Down Expand Up @@ -340,9 +342,9 @@ def _load_config_real_number(


def load_config(file_path: str) -> None:
if not os.path.exists(file_path):
if not os.path.exists(file_path) and os.path.isfile(file_path):
print(f"Error: Config not found: {file_path}")
sys.exit(4)
sys.exit(1)

config_file = None
with open(file_path, mode="r") as file:
Expand Down

0 comments on commit e6044fa

Please sign in to comment.