Skip to content

Commit

Permalink
[BugReport] add VCM logs to the report
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Apr 12, 2021
1 parent 772f13f commit 46e8501
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions tools/BugReportTool/BugReportTool/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ void reportDotNetInstallationInfo(const filesystem::path& tmpDir)
}
}

void reportVCMLogs(const filesystem::path& tmpDir, const filesystem::path& reportDir)
{
error_code ec;
copy(tmpDir / "PowerToysVideoConference_x86.log", reportDir, ec);
copy(tmpDir / "PowerToysVideoConference_x64.log", reportDir, ec);
}

int wmain(int argc, wchar_t* argv[], wchar_t*)
{
// Get path to save zip
Expand All @@ -232,20 +239,20 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
auto settingsRootPath = PTSettingsHelper::get_root_save_folder_location();
settingsRootPath = settingsRootPath + L"\\";

const auto tempDir = temp_directory_path();
// Copy to a temp folder
auto tmpDir = temp_directory_path();
tmpDir = tmpDir.append("PowerToys\\");
if (!deleteFolder(tmpDir))
auto reportDir = tempDir / "PowerToys\\";
if (!deleteFolder(reportDir))
{
printf("Failed to delete temp folder\n");
return 1;
}

try
{
copy(settingsRootPath, tmpDir, copy_options::recursive);
copy(settingsRootPath, reportDir, copy_options::recursive);
// Remove updates folder contents
deleteFolder(tmpDir / "Updates");
deleteFolder(reportDir / "Updates");
}
catch (...)
{
Expand All @@ -254,19 +261,21 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
}

// Hide sensitive information
hideUserPrivateInfo(tmpDir);
hideUserPrivateInfo(reportDir);

// Write monitors info to the report folder
reportMonitorInfo(reportDir);

// Write monitors info to the temporary folder
reportMonitorInfo(tmpDir);
// Write windows version info to the report folder
reportWindowsVersion(reportDir);

// Write windows version info to the temporary folder
reportWindowsVersion(tmpDir);
// Write dotnet installation info to the report folder
reportDotNetInstallationInfo(reportDir);

// Write dotnet installation info to the temporary folder
reportDotNetInstallationInfo(tmpDir);
// Write registry to the report folder
reportRegistry(reportDir);

// Write registry to the temporary folder
reportRegistry(tmpDir);
reportVCMLogs(tempDir, reportDir);

// Zip folder
auto zipPath = path::path(saveZipPath);
Expand All @@ -277,14 +286,14 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)

try
{
zipFolder(zipPath, tmpDir);
zipFolder(zipPath, reportDir);
}
catch (...)
{
printf("Failed to zip folder\n");
return 1;
}

deleteFolder(tmpDir);
deleteFolder(reportDir);
return 0;
}

0 comments on commit 46e8501

Please sign in to comment.