From 9b8970fd9c8751c9fd47b5ecd70c66c393f55b65 Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Tue, 20 Apr 2021 14:47:59 +0300 Subject: [PATCH] [Setup] Introduce a flag to always start PowerToys after install (#10838) --- .../bootstrapper/bootstrapper.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp index 4c3e030ca5..144f54abaa 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp +++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp @@ -136,8 +136,9 @@ int Bootstrapper(HINSTANCE hInstance) options.add_options() ("h,help", "Show help") ("no_full_ui", "Use reduced UI for MSI") - ("s,silent", "Suppress MSI UI and notifications") + ("s,silent", "Suppress all UI, notifications and does not start PowerToys") ("no_start_pt", "Do not launch PowerToys after the installation is complete") + ("start_pt", "Always launch PowerToys after the installation is complete") ("skip_dotnet_install", "Skip dotnet 3.X installation even if it's not detected") ("log_level", "Log level. Possible values: off|debug|error", cxxopts::value()->default_value("off")) ("log_dir", "Log directory", cxxopts::value()->default_value(".")) @@ -169,10 +170,11 @@ int Bootstrapper(HINSTANCE hInstance) const bool noFullUI = cmdArgs["no_full_ui"].as(); const bool skipDotnetInstall = cmdArgs["skip_dotnet_install"].as(); const bool noStartPT = cmdArgs["no_start_pt"].as(); + const bool startPT = cmdArgs["start_pt"].as(); const auto logLevel = cmdArgs["log_level"].as(); const auto logDirArg = cmdArgs["log_dir"].as(); const auto installDirArg = cmdArgs["install_dir"].as(); - const bool extract_msi_only = cmdArgs["extract_msi"].as(); + const bool extractMsiOnly = cmdArgs["extract_msi"].as(); std::wstring installFolderProp; if (!installDirArg.empty()) @@ -216,7 +218,7 @@ int Bootstrapper(HINSTANCE hInstance) } SetupLogger(logDir, severity); - spdlog::debug("PowerToys Bootstrapper is launched\nnoFullUI: {}\nsilent: {}\nno_start_pt: {}\nskip_dotnet_install: {}\nlog_level: {}\ninstall_dir: {}\nextract_msi: {}\n", noFullUI, g_Silent, noStartPT, skipDotnetInstall, logLevel, installDirArg, extract_msi_only); + spdlog::debug("PowerToys Bootstrapper is launched\nnoFullUI: {}\nsilent: {}\nno_start_pt: {}\nskip_dotnet_install: {}\nlog_level: {}\ninstall_dir: {}\nextract_msi: {}\n", noFullUI, g_Silent, noStartPT, skipDotnetInstall, logLevel, installDirArg, extractMsiOnly); const VersionHelper myVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION); @@ -229,7 +231,7 @@ int Bootstrapper(HINSTANCE hInstance) } // If a user requested an MSI -> extract it and exit - if (extract_msi_only) + if (extractMsiOnly) { if (const auto installerPath = ExtractEmbeddedInstaller(fs::current_path())) { @@ -416,7 +418,7 @@ int Bootstrapper(HINSTANCE hInstance) spdlog::debug("Installation completed"); - if (!noStartPT && !g_Silent) + if ((!noStartPT && !g_Silent) || startPT) { spdlog::debug("Starting the newly installed PowerToys.exe"); auto newPTPath = updating::get_msi_package_installed_path();