Skip to content

Commit a7452d2

Browse files
committed
Also support running webots from appdata
1 parent 08b1ead commit a7452d2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/run_simulator.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import sys
1010
import traceback
11+
from os.path import expandvars
1112
from pathlib import Path
1213
from shutil import which
1314
from subprocess import Popen
@@ -43,7 +44,17 @@ def get_webots_parameters() -> tuple[Path, Path]:
4344
if sys.platform == "darwin":
4445
webots = "/Applications/Webots.app/Contents/MacOS/webots"
4546
elif sys.platform == "win32":
46-
webots = "C:\\Program Files\\Webots\\msys64\\mingw64\\bin\\webotsw.exe"
47+
possible_paths = [
48+
"C:\\Program Files\\Webots\\msys64\\mingw64\\bin\\webotsw.exe",
49+
expandvars("%LOCALAPPDATA%\\Programs\\Webots\\msys64\\mingw64\\bin\\webotsw.exe"),
50+
]
51+
for path in possible_paths:
52+
if Path(path).exists():
53+
webots = path
54+
break
55+
else:
56+
print("Webots executable not found.")
57+
raise RuntimeError
4758
elif sys.platform.startswith("linux"):
4859
possible_paths = ["/usr/local/bin/webots", "/usr/bin/webots"]
4960
for path in possible_paths:

0 commit comments

Comments
 (0)