Skip to content

Commit

Permalink
Changed paths from C:/ProgramData to generic ProgramData folder (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd authored Nov 15, 2023
2 parents af85473 + 52d0a84 commit e5b3083
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
4 changes: 2 additions & 2 deletions LadybugTools_Engine/Query/IsPollinationInstalled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ 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.");
return false;
}

// 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))
{
Expand Down

0 comments on commit e5b3083

Please sign in to comment.