Skip to content

Commit

Permalink
[Fix] When using the registry, validate the path is valid (Unity-Tech…
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentpierre authored Aug 4, 2021
1 parent d199d01 commit 8bf91f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ml-agents-envs/mlagents_envs/registry/binary_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from sys import platform
from typing import Tuple, Optional, Dict, Any

from mlagents_envs.env_utils import validate_environment_path

from mlagents_envs.logging_util import get_logger

logger = get_logger(__name__)
Expand Down Expand Up @@ -84,6 +86,10 @@ def get_local_binary_path_if_exists(name: str, url: str) -> Optional[str]:
for c in candidates:
# Unity sometimes produces another .exe file that we must filter out
if "UnityCrashHandler64" not in c:
# If the file is not valid, return None and delete faulty directory
if validate_environment_path(c) is None:
shutil.rmtree(c)
return None
return c
return None

Expand Down

0 comments on commit 8bf91f9

Please sign in to comment.