Add custom executable paths on Windows

This commit is contained in:
grossmj 2023-12-05 21:24:40 +10:00
parent 7f05a06766
commit 08ee40548f
No known key found for this signature in database
GPG Key ID: 0A2D76AC45EA25CD
3 changed files with 9 additions and 0 deletions

View File

@ -656,6 +656,9 @@ class BaseNode:
""" """
path = self._manager.config.get_section_config("Server").get("ubridge_path", "ubridge") path = self._manager.config.get_section_config("Server").get("ubridge_path", "ubridge")
if sys.platform.startswith("win") and hasattr(sys, "frozen"):
ubridge_dir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "ubridge"))
os.environ["PATH"] = os.pathsep.join(ubridge_dir) + os.pathsep + os.environ.get("PATH", "")
path = shutil.which(path) path = shutil.which(path)
return path return path

View File

@ -252,6 +252,9 @@ class Dynamips(BaseManager):
# look for Dynamips # look for Dynamips
dynamips_path = self.config.get_section_config("Dynamips").get("dynamips_path", "dynamips") dynamips_path = self.config.get_section_config("Dynamips").get("dynamips_path", "dynamips")
if not os.path.isabs(dynamips_path): if not os.path.isabs(dynamips_path):
if sys.platform.startswith("win") and hasattr(sys, "frozen"):
dynamips_dir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "dynamips"))
os.environ["PATH"] = os.pathsep.join(dynamips_dir) + os.pathsep + os.environ.get("PATH", "")
dynamips_path = shutil.which(dynamips_path) dynamips_path = shutil.which(dynamips_path)
if not dynamips_path: if not dynamips_path:

View File

@ -140,6 +140,9 @@ class VPCSVM(BaseNode):
vpcs_path = self._manager.config.get_section_config("VPCS").get("vpcs_path", "vpcs") vpcs_path = self._manager.config.get_section_config("VPCS").get("vpcs_path", "vpcs")
if not os.path.isabs(vpcs_path): if not os.path.isabs(vpcs_path):
if sys.platform.startswith("win") and hasattr(sys, "frozen"):
vpcs_dir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "vpcs"))
os.environ["PATH"] = os.pathsep.join(vpcs_dir) + os.pathsep + os.environ.get("PATH", "")
vpcs_path = shutil.which(vpcs_path) vpcs_path = shutil.which(vpcs_path)
return vpcs_path return vpcs_path