diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index 4d6a3c53..5d803458 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -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()); }