diff --git a/LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs b/LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs index 91d52dc1..1b75693e 100644 --- a/LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs +++ b/LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs @@ -38,7 +38,7 @@ public static partial class Compute public static PythonEnvironment InstallPythonEnv_LBT(bool run = false, bool reinstall = false) { // check if referenced Python is installed - string referencedExecutable = @"C:\Program Files\ladybug_tools\python\python.exe"; + string referencedExecutable = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\ladybug_tools\python\python.exe"; if (!Query.IsPollinationInstalled()) { diff --git a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/__init__.py b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/__init__.py index 0752b46f..0a3d66bc 100644 --- a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/__init__.py +++ b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/__init__.py @@ -1,17 +1,16 @@ """Root for the bhom subpackage.""" from pathlib import Path # pylint: disable=E0401 +from os import path from win32api import HIWORD, LOWORD, GetFileVersionInfo -BHOM_ASSEMBLIES_DIRECTORY = Path("C:/ProgramData/BHoM/Assemblies") -BHOM_DIRECTORY = Path("C:/ProgramData/BHoM") -BHOM_LOG_FOLDER = Path("C:/ProgramData/BHoM/Logs") +BHOM_ASSEMBLIES_DIRECTORY = Path(path.expandvars("%PROGRAMDATA%/BHoM/Assemblies")) +BHOM_DIRECTORY = Path(path.expandvars("%PROGRAMDATA%/BHoM")) +BHOM_LOG_FOLDER = Path(path.expandvars("%PROGRAMDATA%/BHoM/Logs")) -PYTHON_CODE_DIRECTORY = Path("C:/ProgramData/BHoM/Extensions/PythonCode") -PYTHON_ENVIRONMENTS_DIRECTORY = Path( - "C:/ProgramData/BHoM/Extensions/PythonEnvironments" -) +PYTHON_CODE_DIRECTORY = Path(path.expandvars("%PROGRAMDATA%/BHoM/Extensions/PythonCode")) +PYTHON_ENVIRONMENTS_DIRECTORY = Path(path.expandvars("%PROGRAMDATA%/BHoM/Extensions/PythonEnvironments")) TOOLKIT_NAME = "LadybugTools_Toolkit" diff --git a/LadybugTools_Engine/Query/IsPollinationInstalled.cs b/LadybugTools_Engine/Query/IsPollinationInstalled.cs index 2f65592e..b10442c5 100644 --- a/LadybugTools_Engine/Query/IsPollinationInstalled.cs +++ b/LadybugTools_Engine/Query/IsPollinationInstalled.cs @@ -41,7 +41,7 @@ public static partial class Query public static bool IsPollinationInstalled(string targetPollinationVersion = "1.38.104", bool includeBuildNumber = false) { // check if referenced Python is installed - string referencedExecutable = @"C:\Program Files\ladybug_tools\python\python.exe"; + string referencedExecutable = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\ladybug_tools\python\python.exe"; if (!File.Exists(referencedExecutable)) { Base.Compute.RecordError($"Could not find referenced python executable at {referencedExecutable}. Please install Pollination version {targetPollinationVersion} and try again."); @@ -49,7 +49,7 @@ public static bool IsPollinationInstalled(string targetPollinationVersion = "1.3 } // obtain version of pollination installed - string referencedUninstaller = @"C:\Program Files\ladybug_tools\uninstall.exe"; + string referencedUninstaller = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\ladybug_tools\uninstall.exe"; FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(referencedUninstaller); if (includeBuildNumber && (versionInfo.ProductVersion != targetPollinationVersion)) {