mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
changed how paths are checked
This commit is contained in:
parent
b98fd5d0a9
commit
c51f31161e
1 changed files with 15 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue