Repository: microsoft/PowerToys
File: src/runner/main.cpp (C++)

Code before:
        return notifications::disable_toast(notifications::PreviewModulesDontShowAgainRegistryPath) ? toast_notification_handler_result::exit_success : toast_notification_handler_result::exit_error;
    }
    else if (param == open_settings)
    {
        open_menu_from_another_instance(std::nullopt);
        return toast_notification_handler_result::exit_success;
    }
    else
    {
        return toast_notification_handler_result::exit_error;
    }
}

void cleanup_updates()
{
    auto state = UpdateState::read();
    if (state.state != UpdateState::upToDate)
    {
        return;
    }

    auto update_dir = updating::get_pending_updates_path();
    if (std::filesystem::exists(update_dir))
    {
        // Msi and exe files
        for (const auto& entry : std::filesystem::directory_iterator(updating::get_pending_updates_path()))
        {
            auto entryPath = entry.path().wstring();
            std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);

            if (entryPath.ends_with(L".msi") || entryPath.ends_with(L".exe"))
            {
                std::error_code err;
                std::filesystem::remove(entry, err);
                if (err.value())
                {
                    Logger::warn("Failed to delete installer file {}. {}", entry.path().string(), err.message());
                }
            }
        }
    }
	
    // Log files
    auto rootPath{ PTSettingsHelper::get_root_save_folder_location() };
    auto currentVersion = left_trim<wchar_t>(get_product_version(), L"v");
    if (std::filesystem::exists(rootPath))
    {
        for (const auto& entry : std::filesystem::directory_iterator(rootPath))
        {
            auto entryPath = entry.path().wstring();
            std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);

Review comment (suggestion):
Perhaps use ` update_dir`  here instead of `updating::get_pending_updates_path()`

Code after:
        return notifications::disable_toast(notifications::PreviewModulesDontShowAgainRegistryPath) ? toast_notification_handler_result::exit_success : toast_notification_handler_result::exit_error;
    }
    else if (param == open_settings)
    {
        open_menu_from_another_instance(std::nullopt);
        return toast_notification_handler_result::exit_success;
    }
    else
    {
        return toast_notification_handler_result::exit_error;
    }
}

void cleanup_updates()
{
    auto state = UpdateState::read();
    if (state.state != UpdateState::upToDate)
    {
        return;
    }

    auto update_dir = updating::get_pending_updates_path();
    if (std::filesystem::exists(update_dir))
    {
        // Msi and exe files
        for (const auto& entry : std::filesystem::directory_iterator(update_dir))
        {
            auto entryPath = entry.path().wstring();
            std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);

            if (entryPath.ends_with(L".msi") || entryPath.ends_with(L".exe"))
            {
                std::error_code err;
                std::filesystem::remove(entry, err);
                if (err.value())
                {
                    Logger::warn("Failed to delete installer file {}. {}", entry.path().string(), err.message());
                }
            }
        }
    }
	
    // Log files
    auto rootPath{ PTSettingsHelper::get_root_save_folder_location() };
    auto currentVersion = left_trim<wchar_t>(get_product_version(), L"v");
    if (std::filesystem::exists(rootPath))
    {
        for (const auto& entry : std::filesystem::directory_iterator(rootPath))
        {
            auto entryPath = entry.path().wstring();
            std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);