Report dotnet runtime installation info (#9069)

This commit is contained in:
Mykhailo Pylyp
2021-01-12 20:48:55 +02:00
committed by GitHub
parent 7a562950b0
commit 9073ce8884
3 changed files with 29 additions and 1 deletions

View File

@@ -10,9 +10,9 @@
#include <common/SettingsAPI/settings_helpers.h>
#include <common/utils/json.h>
#include <common/utils/timeutil.h>
#include <common/utils/exec.h>
#include "ReportMonitorInfo.h"
using namespace std;
using namespace std::filesystem;
using namespace winrt::Windows::Data::Json;
@@ -204,6 +204,28 @@ void reportWindowsVersion(const filesystem::path& tmpDir)
}
}
void reportDotNetInstallationInfo(const filesystem::path& tmpDir)
{
auto dotnetInfoPath = tmpDir;
dotnetInfoPath.append("dotnet-installation-info.txt");
try
{
wofstream dotnetReport(dotnetInfoPath);
auto dotnetInfo = exec_and_read_output(LR"(dotnet --list-runtimes)");
if (!dotnetInfo.has_value())
{
printf("Failed to get dotnet installation information\n");
return;
}
dotnetReport << dotnetInfo.value().c_str();
}
catch (...)
{
printf("Failed to report dotnet installation information");
}
}
int wmain(int argc, wchar_t* argv[], wchar_t*)
{
// Get path to save zip
@@ -259,6 +281,9 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
// Write windows version info to the temporary folder
reportWindowsVersion(tmpDir);
// Write dotnet installation info to the temporary folder
reportDotNetInstallationInfo(tmpDir);
// Zip folder
auto zipPath = path::path(saveZipPath);
std::string reportFilename{"PowerToysReport_"};