Report tool improvements (#8709)

* bugreport: move to tools

* bugreport: skip packaging installers, format time with seconds, remove monitor-info-report tool

* bugreport: move BugReportTool to Tools folder

* fix CI

* fix CDPX
This commit is contained in:
Andrey Nekrasov
2020-12-22 17:15:46 +03:00
committed by GitHub
parent 0843efd282
commit dde63b5017
19 changed files with 108 additions and 282 deletions

View File

@@ -0,0 +1,28 @@
#include "zipfolder.h"
#include "..\..\..\..\deps\cziplib\src\zip.h"
void zipFolder(std::filesystem::path zipPath, std::filesystem::path folderPath)
{
struct zip_t* zip = zip_open(zipPath.string().c_str(), ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
if (!zip)
{
printf("Can not open zip.");
throw -1;
}
using recursive_directory_iterator = std::filesystem::recursive_directory_iterator;
const size_t rootSize = folderPath.wstring().size();
for (const auto& dirEntry : recursive_directory_iterator(folderPath))
{
if (dirEntry.is_regular_file())
{
auto path = dirEntry.path().string();
auto relativePath = path.substr(rootSize, path.size());
zip_entry_open(zip, relativePath.c_str());
zip_entry_fwrite(zip, path.c_str());
zip_entry_close(zip);
}
}
zip_close(zip);
}

View File

@@ -0,0 +1,4 @@
#pragma once
#include <filesystem>
void zipFolder(std::filesystem::path zipPath, std::filesystem::path folderPath);