mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[Log] Remove log_settings.json during installation and set default level to trace (#10438)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/window.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
#include <common/SettingsAPI/settings_helpers.h>
|
||||
|
||||
#include <runner/action_runner_utils.h>
|
||||
|
||||
@@ -79,6 +80,27 @@ void SetupLogger(fs::path directory, const spdlog::level::level_enum severity)
|
||||
}
|
||||
}
|
||||
|
||||
void CleanupSettingsFromOlderVersions()
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto logSettingsFile = fs::path{ PTSettingsHelper::get_root_save_folder_location() } / PTSettingsHelper::log_settings_filename;
|
||||
if (fs::is_regular_file(logSettingsFile))
|
||||
{
|
||||
fs::remove(logSettingsFile);
|
||||
spdlog::info("Removed old log settings file");
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("Old log settings file wasn't found");
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
spdlog::error("Failed to cleanup old log settings");
|
||||
}
|
||||
}
|
||||
|
||||
void ShowMessageBoxError(const wchar_t* message)
|
||||
{
|
||||
if (!g_Silent)
|
||||
@@ -379,6 +401,8 @@ int Bootstrapper(HINSTANCE hInstance)
|
||||
spdlog::error("Unknown exception during dotnet installation");
|
||||
ShowMessageBoxError(IDS_DOTNET_INSTALL_ERROR);
|
||||
}
|
||||
|
||||
CleanupSettingsFromOlderVersions();
|
||||
|
||||
// At this point, there's no reason to show progress bar window, since MSI installers have their own
|
||||
CloseProgressBarDialog();
|
||||
|
||||
Reference in New Issue
Block a user