2024-01-07 15:32:56 +02:00
|
|
|
#ifndef _TEST_CRASH_PRINTER_HELPER_H
|
|
|
|
#define _TEST_CRASH_PRINTER_HELPER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <filesystem>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
static inline bool remove_file(const std::string &file)
|
|
|
|
{
|
2024-06-15 20:20:31 +03:00
|
|
|
const std::filesystem::path p_file(std::filesystem::u8path(file));
|
2024-04-28 00:45:11 +03:00
|
|
|
if (!std::filesystem::exists(p_file)) {
|
2024-01-07 15:32:56 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-04-28 00:45:11 +03:00
|
|
|
if (std::filesystem::is_directory(p_file)) {
|
2024-01-07 15:32:56 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-04-28 00:45:11 +03:00
|
|
|
return std::filesystem::remove(p_file);
|
2024-01-07 15:32:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool remove_file(const std::wstring &file)
|
|
|
|
{
|
|
|
|
if (!std::filesystem::exists(file)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (std::filesystem::is_directory(file)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::filesystem::remove(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-28 00:45:11 +03:00
|
|
|
#endif // _TEST_CRASH_PRINTER_HELPER_H
|