Skip to content

Commit 8bf91f9

Browse files
[Fix] When using the registry, validate the path is valid (#5487)
1 parent d199d01 commit 8bf91f9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ml-agents-envs/mlagents_envs/registry/binary_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from sys import platform
1212
from typing import Tuple, Optional, Dict, Any
1313

14+
from mlagents_envs.env_utils import validate_environment_path
15+
1416
from mlagents_envs.logging_util import get_logger
1517

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

0 commit comments

Comments
 (0)