Skip to content

Commit

Permalink
Also support running webots from appdata
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed Oct 12, 2024
1 parent 08b1ead commit a7452d2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/run_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import sys
import traceback
from os.path import expandvars
from pathlib import Path
from shutil import which
from subprocess import Popen
Expand Down Expand Up @@ -43,7 +44,17 @@ def get_webots_parameters() -> tuple[Path, Path]:
if sys.platform == "darwin":
webots = "/Applications/Webots.app/Contents/MacOS/webots"
elif sys.platform == "win32":
webots = "C:\\Program Files\\Webots\\msys64\\mingw64\\bin\\webotsw.exe"
possible_paths = [
"C:\\Program Files\\Webots\\msys64\\mingw64\\bin\\webotsw.exe",
expandvars("%LOCALAPPDATA%\\Programs\\Webots\\msys64\\mingw64\\bin\\webotsw.exe"),
]
for path in possible_paths:
if Path(path).exists():
webots = path
break
else:
print("Webots executable not found.")
raise RuntimeError
elif sys.platform.startswith("linux"):
possible_paths = ["/usr/local/bin/webots", "/usr/bin/webots"]
for path in possible_paths:
Expand Down

0 comments on commit a7452d2

Please sign in to comment.