[Exception] Changed checks to use c++ experimental features

This commit is contained in:
/dev/root 2017-03-15 19:30:15 +01:00
parent 37e2dafb00
commit f0f4a5b6cc
3 changed files with 15 additions and 5 deletions

View File

@ -259,12 +259,10 @@ namespace Components
#pragma warning(pop)
// Check if folder exists && crash-helper exists
if (PathIsDirectoryA("minidumps\\") && Utils::IO::FileExists("crash-helper.exe"))
if (Utils::IO::DirectoryExists("minidumps\\") && Utils::IO::FileExists("crash-helper.exe"))
{
// Walk through directory and search for valid minidumps
WIN32_FIND_DATAA ffd;
HANDLE hFind = FindFirstFileA(Utils::String::VA("%s\\*.dmp", "minidumps"), &ffd);
if (hFind != INVALID_HANDLE_VALUE)
if (!Utils::IO::DirectoryIsEmpty("minidumps\\"))
{
STARTUPINFOA sInfo;
PROCESS_INFORMATION pInfo;

View File

@ -83,6 +83,16 @@ namespace Utils
return std::experimental::filesystem::create_directories(dir);
}
bool DirectoryExists(std::string directory)
{
return std::experimental::filesystem::is_directory(directory);
}
bool DirectoryIsEmpty(std::string directory)
{
return std::experimental::filesystem::is_empty(directory);
}
std::vector<std::string> ListFiles(std::string dir)
{
std::vector<std::string> files;

View File

@ -10,6 +10,8 @@ namespace Utils
std::string ReadFile(std::string file);
size_t FileSize(std::string file);
bool CreateDir(std::string dir);
bool DirectoryExists(std::string file);
bool DirectoryIsEmpty(std::string file);
std::vector<std::string> ListFiles(std::string dir);
}
}