mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[Auto-update] Auto-update improvements (#11356)
* [Updating] Refactor autoupdate mechanism to use Settings window buttons * [Updating] Don't use underscores in update_state (#11029) * [Updating] Rename action_runner to be consisent with accepted format * [Updating] Make UpdateState values explicit * [Setup] Set default bootstrapper log severity to debug * [BugReport] Include all found bootstrapper logs * [Setup] Use capital letter for ActionRunner * [Updating] Simple UI to test UpdateState * [Action Runner] cleanup and coding style * [BugReportTool] fix coding convension * [Auto-update][PT Settings] Updated general page in the Settings (#11227) * [Auto-update][PT Settings] File watcher monitoring UpdateState.json (#11282) * Handle button clicks (#11288) * [Updating] Document ActionRunner cmd flags * [Auto-update][PT Settings] Updated UI (#11335) * [Updating] Do not reset update state when msi cancellation detected * [Updating] Directly launch update_now PT action instead of using custom URI scheme * Checking for updates UI (#11354) * [Updating] Fix cannotDownload state in action runner * [Updating] Reset update state to CannotDownload if action runner encountered an error * [Updating][PT Settings] downloading label, disable button in error state * Changed error message * [Updating rename CannotDownload to ErrorDownloading * [Updating] Add trace logging for Check for updates callback * [Updating][PT Settings] simplify downloading checks * [Updating][PT Settings] Updated text labels * [Updating][PT Settings] Retry to load settings if failed * [Updating][PT Settings] Text fix * [Updating][PT Settings] Installed version links removed * [Updating][PT Settings] Error text updated * [Updating][PT Settings] Show label after version checked * [Updating][PT Settings] Text foreground fix * [Updating][PT Settings] Clean up * [Updating] Do not reset releasePageUrl in case of error/cancellation * [Updating][PT Settings] fixed missing string * [Updating][PT Settings] checked for updates state fix Co-authored-by: yuyoyuppe <a.yuyoyuppe@gmail.com> Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com>
This commit is contained in:
@@ -142,7 +142,7 @@ void HideUserPrivateInfo(const filesystem::path& dir)
|
||||
HideForFile(dir, it.first);
|
||||
}
|
||||
|
||||
// delete files
|
||||
// Delete files
|
||||
for (auto it : filesToDelete)
|
||||
{
|
||||
auto path = dir;
|
||||
@@ -243,6 +243,26 @@ void ReportDotNetInstallationInfo(const filesystem::path& tmpDir)
|
||||
}
|
||||
}
|
||||
|
||||
void ReportBootstrapperLog(const filesystem::path& targetDir)
|
||||
{
|
||||
for (const auto entry : filesystem::directory_iterator{temp_directory_path()})
|
||||
{
|
||||
if (!entry.is_regular_file() || !entry.path().has_filename())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::wstring filename = entry.path().filename().native();
|
||||
if (!filename.starts_with(L"powertoys-bootstrapper-") || !filename.ends_with(L".log"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::error_code _;
|
||||
copy(entry.path(), targetDir, _);
|
||||
}
|
||||
}
|
||||
|
||||
int wmain(int argc, wchar_t* argv[], wchar_t*)
|
||||
{
|
||||
// Get path to save zip
|
||||
@@ -280,6 +300,7 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
|
||||
try
|
||||
{
|
||||
copy(settingsRootPath, tmpDir, copy_options::recursive);
|
||||
|
||||
// Remove updates folder contents
|
||||
DeleteFolder(tmpDir / "Updates");
|
||||
}
|
||||
@@ -296,7 +317,7 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
|
||||
ReportWindowsSettings(tmpDir);
|
||||
|
||||
// Write monitors info to the temporary folder
|
||||
reportMonitorInfo(tmpDir);
|
||||
ReportMonitorInfo(tmpDir);
|
||||
|
||||
// Write windows version info to the temporary folder
|
||||
ReportWindowsVersion(tmpDir);
|
||||
@@ -310,6 +331,8 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
|
||||
// Write compatibility tab info to the temporary folder
|
||||
ReportCompatibilityTab(tmpDir);
|
||||
|
||||
ReportBootstrapperLog(tmpDir);
|
||||
|
||||
// Zip folder
|
||||
auto zipPath = path::path(saveZipPath);
|
||||
std::string reportFilename{"PowerToysReport_"};
|
||||
|
||||
@@ -246,6 +246,7 @@ void ReportRegistry(const filesystem::path& tmpDir)
|
||||
{
|
||||
registryReport << "ERROR " << result << "\n";
|
||||
}
|
||||
|
||||
registryReport << "\n";
|
||||
}
|
||||
|
||||
@@ -288,12 +289,14 @@ void ReportRegistry(const filesystem::path& tmpDir)
|
||||
registryReport << "ERROR " << result << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(rootKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
registryReport << "ERROR " << result << "\n";
|
||||
}
|
||||
|
||||
registryReport << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
#include <Windows.h>
|
||||
|
||||
void ReportRegistry(const std::filesystem::path& tmpDir);
|
||||
void ReportCompatibilityTab(const std::filesystem::path& tmpDir);
|
||||
void ReportCompatibilityTab(const std::filesystem::path& tmpDir);
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
int buildMonitorInfoReport(std::wostream& os)
|
||||
int BuildMonitorInfoReport(std::wostream& os)
|
||||
{
|
||||
struct capture
|
||||
{
|
||||
@@ -45,6 +45,7 @@ namespace
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
capture c;
|
||||
c.os = &os;
|
||||
if (EnumDisplayMonitors(nullptr, nullptr, callback, (LPARAM)&c))
|
||||
@@ -60,7 +61,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void reportMonitorInfo(const filesystem::path& tmpDir)
|
||||
void ReportMonitorInfo(const filesystem::path& tmpDir)
|
||||
{
|
||||
auto monitorReportPath = tmpDir;
|
||||
monitorReportPath.append("monitor-report-info.txt");
|
||||
@@ -69,7 +70,7 @@ void reportMonitorInfo(const filesystem::path& tmpDir)
|
||||
{
|
||||
wofstream monitorReport(monitorReportPath);
|
||||
monitorReport << "GetSystemMetrics = " << GetSystemMetrics(SM_CMONITORS) << '\n';
|
||||
buildMonitorInfoReport(monitorReport);
|
||||
BuildMonitorInfoReport(monitorReport);
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#include <fstream>
|
||||
|
||||
void reportMonitorInfo(const std::filesystem::path& tmpDir);
|
||||
void ReportMonitorInfo(const std::filesystem::path& tmpDir);
|
||||
|
||||
Reference in New Issue
Block a user