mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 07:45:58 +01:00
crashreporter: Use ~/.cache as cache dir (#4719)
* use ~/.cache for crash reports * minor word edit * clang-format * minor typo
This commit is contained in:
parent
e793f10b8b
commit
030ed27cc8
2 changed files with 10 additions and 13 deletions
|
@ -47,7 +47,7 @@ basically, directories in /tmp/hypr are your sessions.
|
||||||
|
|
||||||
## Obtaining the Hyprland Crash Report (v0.22.0beta and up)
|
## Obtaining the Hyprland Crash Report (v0.22.0beta and up)
|
||||||
|
|
||||||
If you have `$XDG_CACHE_HOME` set, the crash report directory is `$XDG_CACHE_HOME/hyprland`. If not, it's `~/.hyprland`
|
If you have `$XDG_CACHE_HOME` set, the crash report directory is `$XDG_CACHE_HOME/hyprland`. If not, it's `$HOME/.cache/hyprland`.
|
||||||
|
|
||||||
Go to the crash report directory and you should find a file named `hyprlandCrashReport[XXXX].txt` where `[XXXX]` is the PID of the process that crashed.
|
Go to the crash report directory and you should find a file named `hyprlandCrashReport[XXXX].txt` where `[XXXX]` is the PID of the process that crashed.
|
||||||
|
|
||||||
|
|
|
@ -146,22 +146,19 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::ofstream ofs;
|
std::ofstream ofs;
|
||||||
std::string path;
|
std::string reportDir;
|
||||||
if (!CACHE_HOME || std::string(CACHE_HOME).empty()) {
|
|
||||||
if (!std::filesystem::exists(std::string(HOME) + "/.hyprland"))
|
if (!CACHE_HOME || std::string(CACHE_HOME).empty())
|
||||||
std::filesystem::create_directory(std::string(HOME) + "/.hyprland");
|
reportDir = std::string(HOME) + "/.cache/hyprland";
|
||||||
|
else
|
||||||
|
reportDir = std::string(CACHE_HOME) + "/hyprland";
|
||||||
|
|
||||||
|
if (!std::filesystem::exists(reportDir))
|
||||||
|
std::filesystem::create_directory(reportDir);
|
||||||
|
const auto path = reportDir + "/hyprlandCrashReport" + std::to_string(PID) + ".txt";
|
||||||
|
|
||||||
path = std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
|
|
||||||
ofs.open(path, std::ios::trunc);
|
ofs.open(path, std::ios::trunc);
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!std::filesystem::exists(std::string(CACHE_HOME) + "/hyprland"))
|
|
||||||
std::filesystem::create_directory(std::string(CACHE_HOME) + "/hyprland");
|
|
||||||
|
|
||||||
path = std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
|
|
||||||
ofs.open(path, std::ios::trunc);
|
|
||||||
}
|
|
||||||
|
|
||||||
ofs << finalCrashReport;
|
ofs << finalCrashReport;
|
||||||
|
|
||||||
ofs.close();
|
ofs.close();
|
||||||
|
|
Loading…
Reference in a new issue