From 57b06fa431ff2c2f20e5ca4e1b117b1a1c634091 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Thu, 11 Jul 2024 13:49:52 +0100 Subject: [PATCH] [Installer]Create DSC module in right path for user installs (#33782) --- installer/PowerToysSetupCustomActions/CustomAction.cpp | 4 ++-- src/common/version/version.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp index 064976c99e..64c03bc44f 100644 --- a/installer/PowerToysSetupCustomActions/CustomAction.cpp +++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp @@ -357,7 +357,7 @@ UINT __stdcall InstallDSCModuleCA(MSIHANDLE hInstall) ExitOnFailure(hr, "Unable to determine Powershell modules path"); } - const auto modulesPath = baseModulesPath / L"Microsoft.PowerToys.Configure" / get_product_version(); + const auto modulesPath = baseModulesPath / L"Microsoft.PowerToys.Configure" / get_product_version(false); std::error_code errorCode; fs::create_directories(modulesPath, errorCode); @@ -411,7 +411,7 @@ UINT __stdcall UninstallDSCModuleCA(MSIHANDLE hInstall) } const auto powerToysModulePath = baseModulesPath / L"Microsoft.PowerToys.Configure"; - const auto versionedModulePath = powerToysModulePath / get_product_version(); + const auto versionedModulePath = powerToysModulePath / get_product_version(false); std::error_code errorCode; diff --git a/src/common/version/version.h b/src/common/version/version.h index f1602e10c4..d57b2eae6c 100644 --- a/src/common/version/version.h +++ b/src/common/version/version.h @@ -27,18 +27,18 @@ enum class version_architecture version_architecture get_current_architecture(); const wchar_t* get_architecture_string(const version_architecture); -inline std::wstring get_product_version() +inline std::wstring get_product_version(bool includeV = true) { - static std::wstring version = L"v" + std::to_wstring(VERSION_MAJOR) + + static std::wstring version = (includeV ? L"v" : L"") + std::to_wstring(VERSION_MAJOR) + L"." + std::to_wstring(VERSION_MINOR) + L"." + std::to_wstring(VERSION_REVISION); return version; } -inline std::wstring get_std_product_version() +inline std::wstring get_std_product_version(bool includeV = true) { - static std::wstring version = L"v" + std::to_wstring(VERSION_MAJOR) + + static std::wstring version = (includeV ? L"v" : L"") + std::to_wstring(VERSION_MAJOR) + L"." + std::to_wstring(VERSION_MINOR) + L"." + std::to_wstring(VERSION_REVISION) + L".0";