Reformat PGOHelper (Resharper)

This commit is contained in:
Vladimir Kononovich 2020-12-19 23:31:47 +03:00
parent b792e0a3f0
commit 4925698573

View file

@ -3,8 +3,8 @@
#include <algorithm> #include <algorithm>
#include <unordered_set> #include <unordered_set>
#if __has_include(<filesystem>) #if __has_include(<filesystem>)
#include <filesystem> #include <filesystem>
namespace fs = std::filesystem; namespace fs = std::filesystem;
#elif __has_include(<experimental/filesystem>) #elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem> #include <experimental/filesystem>
namespace fs = std::experimental::filesystem; namespace fs = std::experimental::filesystem;
@ -14,24 +14,28 @@ using std::string;
using std::vector; using std::vector;
extern "C" { extern "C" {
void __stdcall PgoRunTest(vector<string> testRoms, bool enableDebugger); void __stdcall PgoRunTest(vector<string> testRoms, bool enableDebugger);
} }
vector<string> GetFilesInFolder(string rootFolder, std::unordered_set<string> extensions) vector<string> GetFilesInFolder(string rootFolder, std::unordered_set<string> extensions)
{ {
vector<string> files; vector<string> files;
vector<string> folders = { { rootFolder } }; vector<string> folders = {{rootFolder}};
std::error_code errorCode; std::error_code errorCode;
if(!fs::is_directory(fs::u8path(rootFolder), errorCode)) { if (!fs::is_directory(fs::u8path(rootFolder), errorCode))
{
return files; return files;
} }
for(string folder : folders) { for (string folder : folders)
for(fs::directory_iterator i(fs::u8path(folder.c_str())), end; i != end; i++) { {
for (fs::directory_iterator i(fs::u8path(folder.c_str())), end; i != end; i++)
{
string extension = i->path().extension().u8string(); string extension = i->path().extension().u8string();
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
if(extensions.find(extension) != extensions.end()) { if (extensions.find(extension) != extensions.end())
{
files.push_back(i->path().u8string()); files.push_back(i->path().u8string());
} }
} }
@ -43,12 +47,12 @@ vector<string> GetFilesInFolder(string rootFolder, std::unordered_set<string> ex
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
string romFolder = "../PGOGames"; string romFolder = "../PGOGames";
if(argc >= 2) { if (argc >= 2)
{
romFolder = argv[1]; romFolder = argv[1];
} }
vector<string> testRoms = GetFilesInFolder(romFolder, { {".sfc", ".gb", ".gbc"} }); vector<string> testRoms = GetFilesInFolder(romFolder, {{".sfc", ".gb", ".gbc"}});
PgoRunTest(testRoms, true); PgoRunTest(testRoms, true);
return 0; return 0;
} }