Skip to content

Commit 6ca2b8a

Browse files
itsXuStdeepin-bot[bot]
authored andcommitted
chore: redirect crash log to cache path.
as above. Log: as above. (cherry picked from commit 006c772)
1 parent 9bcd403 commit 6ca2b8a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

deepin-system-monitor-main/stack_trace.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <stdlib.h>
1818
#include <unistd.h>
1919

20+
#include <QStandardPaths>
21+
2022
namespace util {
2123

2224
#define MAX_BACKTRACE_FRAMES 128
@@ -52,7 +54,9 @@ static inline void printStacktrace(int signum)
5254
logstr[len] = 0;
5355

5456
// open log output stream
55-
std::string logN {"/tmp/"};
57+
auto cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
58+
if (!cachePath.endsWith("/")) cachePath.append("/");
59+
std::string logN {cachePath.toStdString()};
5660
logN.append(logstr);
5761
std::ofstream log(logN, std::ios::out);
5862

0 commit comments

Comments
 (0)