From c51f31161eea1a664912dfe0f4f8dc384a471a5a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 31 Mar 2021 15:07:20 +0200 Subject: [PATCH] changed how paths are checked --- igniter/tools.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/igniter/tools.py b/igniter/tools.py index 80fcd5a9e6..7f5aa8d876 100644 --- a/igniter/tools.py +++ b/igniter/tools.py @@ -6,6 +6,7 @@ Functions ``compose_url()`` and ``decompose_url()`` are the same as in version is decided. """ +import os from typing import Dict, Union from urllib.parse import urlparse, parse_qs from pathlib import Path @@ -234,3 +235,17 @@ def get_pype_path_from_db(url: str) -> Union[str, None]: """ global_settings = get_pype_global_settings(url) return global_settings.get("pype_path", {}).get(platform.system().lower()) + paths = ( + global_settings + .get("pype_path", {}) + .get(platform.system().lower()) + ) or [] + # For cases when `pype_path` is a single path + if paths and isinstance(paths, str): + paths = [paths] + + # Loop over paths and return only existing + for path in paths: + if os.path.exists(path): + return path + return None