From 03fef71d888d6d56c63cad044fff3e105c11e584 Mon Sep 17 00:00:00 2001 From: paulober <44974737+paulober@users.noreply.github.com> Date: Wed, 8 May 2024 15:59:07 +0200 Subject: [PATCH] Undo some changes Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- scripts/pico_project.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/scripts/pico_project.py b/scripts/pico_project.py index 7afc1d90..548967d9 100644 --- a/scripts/pico_project.py +++ b/scripts/pico_project.py @@ -356,12 +356,24 @@ def cmakeToolchainPath(toolchainVersion): def cmakeToolsPath(sdkVersion): return f"${{USERHOME}}{relativeToolsPath(sdkVersion)}" +def propertiesSdkPath(sdkVersion, force_windows=False, force_non_windows=False): + if (isWindows or force_windows) and not force_non_windows: + return f"${{env:USERPROFILE}}{relativeSDKPath(sdkVersion)}" + else: + return f"${{env:HOME}}{relativeSDKPath(sdkVersion)}" + def codeSdkPath(sdkVersion): return f"${{userHome}}{relativeSDKPath(sdkVersion)}" def codeOpenOCDPath(openocdVersion): return f"${{userHome}}{relativeOpenOCDPath(openocdVersion)}" +def propertiesToolchainPath(toolchainVersion, force_windows=False, force_non_windows=False): + if (isWindows or force_windows) and not force_non_windows: + return f"${{env:USERPROFILE}}{relativeToolchainPath(toolchainVersion)}" + else: + return f"${{env:HOME}}{relativeToolchainPath(toolchainVersion)}" + def codeToolchainPath(toolchainVersion): return f"${{userHome}}{relativeToolchainPath(toolchainVersion)}" @@ -858,19 +870,19 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, "cmake.cmakePath": "{cmakePath.replace(user_home, "${userHome}") if use_home_var else cmakePath}", "C_Cpp.debugShortcut": false, "terminal.integrated.env.windows": {{ - "PICO_SDK_PATH": "{codeSdkPath(sdkVersion)}", - "PICO_TOOLCHAIN_PATH": "{codeToolchainPath(sdkVersion)}", - "Path": "{codeToolchainPath(toolchainVersion)}/bin;{os.path.dirname(cmakePath.replace(user_home, "${userHome}") if use_home_var else cmakePath)};{os.path.dirname(ninjaPath.replace(user_home, "${userHome}") if use_home_var else ninjaPath)};${{env:PATH}}" + "PICO_SDK_PATH": "{propertiesSdkPath(sdkVersion, force_windows=True)}", + "PICO_TOOLCHAIN_PATH": "{propertiesToolchainPath(sdkVersion, force_windows=True)}", + "Path": "{propertiesToolchainPath(toolchainVersion, force_windows=True)}/bin;{os.path.dirname(cmakePath.replace(user_home, "${env:USERPROFILE}") if use_home_var else cmakePath)};{os.path.dirname(ninjaPath.replace(user_home, "${env:USERPROFILE}") if use_home_var else ninjaPath)};${{env:PATH}}" }}, "terminal.integrated.env.osx": {{ - "PICO_SDK_PATH": "{codeSdkPath(sdkVersion)}", - "PICO_TOOLCHAIN_PATH": "{codeToolchainPath(toolchainVersion)}", - "PATH": "{codeToolchainPath(toolchainVersion)}/bin:{os.path.dirname(cmakePath.replace(user_home, "${userHome}") if use_home_var else cmakePath)}:{os.path.dirname(ninjaPath.replace(user_home, "${userHome}") if use_home_var else ninjaPath)}:${{env:PATH}}" + "PICO_SDK_PATH": "{propertiesSdkPath(sdkVersion, force_non_windows=True)}", + "PICO_TOOLCHAIN_PATH": "{propertiesToolchainPath(toolchainVersion, force_non_windows=True)}", + "PATH": "{propertiesToolchainPath(toolchainVersion, force_non_windows=True)}/bin:{os.path.dirname(cmakePath.replace(user_home, "${env:HOME}") if use_home_var else cmakePath)}:{os.path.dirname(ninjaPath.replace(user_home, "${env:HOME}") if use_home_var else ninjaPath)}:${{env:PATH}}" }}, "terminal.integrated.env.linux": {{ - "PICO_SDK_PATH": "{codeSdkPath(sdkVersion)}", - "PICO_TOOLCHAIN_PATH": "{codeToolchainPath(toolchainVersion)}", - "PATH": "{codeToolchainPath(toolchainVersion)}/bin:{os.path.dirname(cmakePath.replace(user_home, "${userHome}") if use_home_var else cmakePath)}:{os.path.dirname(ninjaPath.replace(user_home, "${userHome}") if use_home_var else ninjaPath)}:${{env:PATH}}" + "PICO_SDK_PATH": "{propertiesSdkPath(sdkVersion, force_non_windows=True)}", + "PICO_TOOLCHAIN_PATH": "{propertiesToolchainPath(toolchainVersion, force_non_windows=True)}", + "PATH": "{propertiesToolchainPath(toolchainVersion, force_non_windows=True)}/bin:{os.path.dirname(cmakePath.replace(user_home, "${env:HOME}") if use_home_var else cmakePath)}:{os.path.dirname(ninjaPath.replace(user_home, "${env:HOME}") if use_home_var else ninjaPath)}:${{env:PATH}}" }}, "raspberry-pi-pico.cmakeAutoConfigure": true, "raspberry-pi-pico.cmakePath": "{cmakePath.replace(user_home, "${HOME}") if use_home_var else cmakePath}",