mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-12-29 02:33:05 +03:00
crashReporter: log on crash
This commit is contained in:
parent
458ea56b86
commit
7b5b4a1049
@ -135,13 +135,15 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||
return;
|
||||
|
||||
std::ofstream ofs;
|
||||
std::string path;
|
||||
if (!CACHE_HOME) {
|
||||
if (!std::filesystem::exists(std::string(HOME) + "/.hyprland")) {
|
||||
std::filesystem::create_directory(std::string(HOME) + "/.hyprland");
|
||||
std::filesystem::permissions(std::string(HOME) + "/.hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace);
|
||||
}
|
||||
|
||||
ofs.open(std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt", std::ios::trunc);
|
||||
path = std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
|
||||
ofs.open(path, std::ios::trunc);
|
||||
|
||||
} else if (CACHE_HOME) {
|
||||
if (!std::filesystem::exists(std::string(CACHE_HOME) + "/hyprland")) {
|
||||
@ -149,7 +151,8 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||
std::filesystem::permissions(std::string(CACHE_HOME) + "/hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace);
|
||||
}
|
||||
|
||||
ofs.open(std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt", std::ios::trunc);
|
||||
path = std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
|
||||
ofs.open(path, std::ios::trunc);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -157,4 +160,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||
ofs << finalCrashReport;
|
||||
|
||||
ofs.close();
|
||||
|
||||
Debug::disableStdout = false;
|
||||
Debug::log(CRIT, "Hyprland has crashed :( Consult the crash report at %s for more information.", path.c_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user