Skip to content

Commit

Permalink
[Setup] Introduce a flag to always start PowerToys after install (#10838
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yuyoyuppe committed Apr 20, 2021
1 parent 78943dc commit 9b8970f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>()->default_value("off"))
("log_dir", "Log directory", cxxopts::value<std::string>()->default_value("."))
Expand Down Expand Up @@ -169,10 +170,11 @@ int Bootstrapper(HINSTANCE hInstance)
const bool noFullUI = cmdArgs["no_full_ui"].as<bool>();
const bool skipDotnetInstall = cmdArgs["skip_dotnet_install"].as<bool>();
const bool noStartPT = cmdArgs["no_start_pt"].as<bool>();
const bool startPT = cmdArgs["start_pt"].as<bool>();
const auto logLevel = cmdArgs["log_level"].as<std::string>();
const auto logDirArg = cmdArgs["log_dir"].as<std::string>();
const auto installDirArg = cmdArgs["install_dir"].as<std::string>();
const bool extract_msi_only = cmdArgs["extract_msi"].as<bool>();
const bool extractMsiOnly = cmdArgs["extract_msi"].as<bool>();

std::wstring installFolderProp;
if (!installDirArg.empty())
Expand Down Expand Up @@ -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);

Expand All @@ -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()))
{
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 9b8970f

Please sign in to comment.