mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Runner] verify the existence of Launcher assets (#10416)
This commit is contained in:
@@ -36,12 +36,13 @@
|
|||||||
#if _DEBUG && _WIN64
|
#if _DEBUG && _WIN64
|
||||||
#include "unhandled_exception_handler.h"
|
#include "unhandled_exception_handler.h"
|
||||||
#endif
|
#endif
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
#include <common/utils/winapi_error.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/version/version.h>
|
|
||||||
#include <common/utils/window.h>
|
|
||||||
#include <runner/settings_window.h>
|
#include <runner/settings_window.h>
|
||||||
|
#include <common/utils/process_path.h>
|
||||||
|
#include <common/utils/winapi_error.h>
|
||||||
|
#include <common/utils/window.h>
|
||||||
|
#include <common/version/version.h>
|
||||||
|
|
||||||
extern updating::notifications::strings Strings;
|
extern updating::notifications::strings Strings;
|
||||||
|
|
||||||
@@ -79,6 +80,30 @@ void open_menu_from_another_instance()
|
|||||||
PostMessageW(hwnd_main, WM_COMMAND, ID_SETTINGS_MENU_COMMAND, 0);
|
PostMessageW(hwnd_main, WM_COMMAND, ID_SETTINGS_MENU_COMMAND, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debug_verify_launcher_assets()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
const fs::path powertoysRoot = get_module_folderpath();
|
||||||
|
constexpr std::array<std::string_view, 4> assetsToCheck = { "modules\\launcher\\Images\\app.dark.png",
|
||||||
|
"modules\\launcher\\Images\\app.light.png",
|
||||||
|
"modules\\launcher\\Images\\app_error.dark.png",
|
||||||
|
"modules\\launcher\\Images\\app_error.light.png" };
|
||||||
|
for (const auto asset : assetsToCheck)
|
||||||
|
{
|
||||||
|
const auto assetPath = powertoysRoot / asset;
|
||||||
|
if (!fs::is_regular_file(assetPath))
|
||||||
|
{
|
||||||
|
Logger::error("{} couldn't be found.", assetPath.string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int runner(bool isProcessElevated, bool openSettings, bool openOobe)
|
int runner(bool isProcessElevated, bool openSettings, bool openOobe)
|
||||||
{
|
{
|
||||||
Logger::info("Runner is starting. Elevated={}", isProcessElevated);
|
Logger::info("Runner is starting. Elevated={}", isProcessElevated);
|
||||||
@@ -96,6 +121,8 @@ int runner(bool isProcessElevated, bool openSettings, bool openOobe)
|
|||||||
int result = -1;
|
int result = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
debug_verify_launcher_assets();
|
||||||
|
|
||||||
std::thread{ [] {
|
std::thread{ [] {
|
||||||
github_update_worker();
|
github_update_worker();
|
||||||
} }.detach();
|
} }.detach();
|
||||||
@@ -161,7 +188,7 @@ int runner(bool isProcessElevated, bool openSettings, bool openOobe)
|
|||||||
|
|
||||||
if (openOobe)
|
if (openOobe)
|
||||||
{
|
{
|
||||||
open_oobe_window();
|
open_oobe_window();
|
||||||
}
|
}
|
||||||
|
|
||||||
settings_telemetry::init();
|
settings_telemetry::init();
|
||||||
@@ -433,7 +460,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
auto general_settings = load_general_settings();
|
auto general_settings = load_general_settings();
|
||||||
const bool openSettings = std::string(lpCmdLine).find("--open-settings") != std::string::npos;
|
const bool openSettings = std::string(lpCmdLine).find("--open-settings") != std::string::npos;
|
||||||
|
|
||||||
|
|
||||||
// Apply the general settings but don't save it as the modules() variable has not been loaded yet
|
// Apply the general settings but don't save it as the modules() variable has not been loaded yet
|
||||||
apply_general_settings(general_settings, false);
|
apply_general_settings(general_settings, false);
|
||||||
int rvalue = 0;
|
int rvalue = 0;
|
||||||
@@ -442,7 +468,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
general_settings.GetNamedBoolean(L"run_elevated", false) == false ||
|
general_settings.GetNamedBoolean(L"run_elevated", false) == false ||
|
||||||
std::string(lpCmdLine).find("--dont-elevate") != std::string::npos))
|
std::string(lpCmdLine).find("--dont-elevate") != std::string::npos))
|
||||||
{
|
{
|
||||||
|
|
||||||
result = runner(elevated, openSettings, openOobe);
|
result = runner(elevated, openSettings, openOobe);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user