Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed paths from C:/ProgramData to generic ProgramData folder #138

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 pathlib import Path # pylint: disable=E0401
Tom-Kingstone marked this conversation as resolved.
Show resolved Hide resolved
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.expandvars("%PROGRAMDATA%/BHoM/Assemblies")
BHOM_DIRECTORY = path.expandvars("%PROGRAMDATA%/BHoM")
BHOM_LOG_FOLDER = path.expandvars("%PROGRAMDATA%/BHoM/Logs")
Tom-Kingstone marked this conversation as resolved.
Show resolved Hide resolved

PYTHON_CODE_DIRECTORY = Path("C:/ProgramData/BHoM/Extensions/PythonCode")
PYTHON_ENVIRONMENTS_DIRECTORY = Path(
"C:/ProgramData/BHoM/Extensions/PythonEnvironments"
)
PYTHON_CODE_DIRECTORY = path.expandvars("%PROGRAMDATA%/BHoM/Extensions/PythonCode")
PYTHON_ENVIRONMENTS_DIRECTORY = path.expandvars("%PROGRAMDATA%/BHoM/Extensions/PythonEnvironments")
Tom-Kingstone marked this conversation as resolved.
Show resolved Hide resolved

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