fix: unix system build.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <Util.h>
|
#include <Util.h>
|
||||||
|
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
|
|||||||
@@ -4271,8 +4271,8 @@ private:
|
|||||||
class SignalHandling
|
class SignalHandling
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static inline std::function<std::string()> crash_path_getter_ = nullptr;
|
static std::function<std::string()> crash_path_getter_;
|
||||||
static inline std::function<void(int sig)> user_sig_handler_ = nullptr;
|
static std::function<void(int sig)> user_sig_handler_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void register_crash_path(std::function<std::string()>&& crash_path_getter)
|
static void register_crash_path(std::function<std::string()>&& crash_path_getter)
|
||||||
|
|||||||
@@ -10,9 +10,14 @@
|
|||||||
|
|
||||||
#include "backward.hpp"
|
#include "backward.hpp"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
std::function<std::string()> backward::SignalHandling::crash_path_getter_ = nullptr;
|
std::function<std::string()> backward::SignalHandling::crash_path_getter_ = nullptr;
|
||||||
std::function<void(EXCEPTION_POINTERS* info)> backward::SignalHandling::crash_use_handler_ = nullptr;
|
std::function<void(EXCEPTION_POINTERS* info)> backward::SignalHandling::crash_use_handler_ = nullptr;
|
||||||
std::function<void(int sig)> backward::SignalHandling::user_sig_handler_ = nullptr;
|
std::function<void(int sig)> backward::SignalHandling::user_sig_handler_ = nullptr;
|
||||||
|
#else
|
||||||
|
std::function<std::string()> crash_path_getter_ = nullptr;
|
||||||
|
std::function<void(int sig)> user_sig_handler_ = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace backward {
|
namespace backward {
|
||||||
|
|
||||||
@@ -132,7 +137,8 @@ void UseExceptionHandler(EXCEPTION_POINTERS* exception)
|
|||||||
QString fullPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpName);
|
QString fullPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpName);
|
||||||
QString fullFailedPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpFailedLog);
|
QString fullFailedPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpFailedLog);
|
||||||
|
|
||||||
HANDLE hFile = CreateFileA(fullPath.toStdString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE hFile =
|
||||||
|
CreateFileA(fullPath.toStdString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
QFile file(fullFailedPath);
|
QFile file(fullFailedPath);
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
@@ -152,4 +158,4 @@ void UseExceptionHandler(EXCEPTION_POINTERS* exception)
|
|||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // namespace backward
|
} // namespace backward
|
||||||
|
|||||||
Reference in New Issue
Block a user