mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
core: log qt related environment variables in debuginfo
This commit is contained in:
parent
1b2519d9f3
commit
9e8eecf2b8
2 changed files with 34 additions and 0 deletions
|
|
@ -1,4 +1,7 @@
|
||||||
#include "debuginfo.hpp"
|
#include "debuginfo.hpp"
|
||||||
|
#include <array>
|
||||||
|
#include <cstring>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <qconfig.h>
|
#include <qconfig.h>
|
||||||
|
|
@ -14,6 +17,8 @@
|
||||||
|
|
||||||
#include "build.hpp"
|
#include "build.hpp"
|
||||||
|
|
||||||
|
extern char** environ; // NOLINT
|
||||||
|
|
||||||
namespace qs::debuginfo {
|
namespace qs::debuginfo {
|
||||||
|
|
||||||
QString qsVersion() {
|
QString qsVersion() {
|
||||||
|
|
@ -119,6 +124,31 @@ QString systemInfo() {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString envInfo() {
|
||||||
|
QString info;
|
||||||
|
auto stream = QTextStream(&info);
|
||||||
|
|
||||||
|
for (auto** envp = environ; *envp != nullptr; ++envp) { // NOLINT
|
||||||
|
auto prefixes = std::array<std::string_view, 5> {
|
||||||
|
"QS_",
|
||||||
|
"QT_",
|
||||||
|
"QML_",
|
||||||
|
"QML2_",
|
||||||
|
"QSG_",
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto& prefix: prefixes) {
|
||||||
|
if (strncmp(prefix.data(), *envp, prefix.length()) == 0) goto print;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
|
print:
|
||||||
|
stream << *envp << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
QString combinedInfo() {
|
QString combinedInfo() {
|
||||||
QString info;
|
QString info;
|
||||||
auto stream = QTextStream(&info);
|
auto stream = QTextStream(&info);
|
||||||
|
|
@ -136,6 +166,9 @@ QString combinedInfo() {
|
||||||
stream << "\n===== System Information =====\n";
|
stream << "\n===== System Information =====\n";
|
||||||
stream << systemInfo();
|
stream << systemInfo();
|
||||||
|
|
||||||
|
stream << "\n===== Environment (trimmed) =====\n";
|
||||||
|
stream << envInfo();
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ QString qsVersion();
|
||||||
QString qtVersion();
|
QString qtVersion();
|
||||||
QString gpuInfo();
|
QString gpuInfo();
|
||||||
QString systemInfo();
|
QString systemInfo();
|
||||||
|
QString envInfo();
|
||||||
QString combinedInfo();
|
QString combinedInfo();
|
||||||
|
|
||||||
} // namespace qs::debuginfo
|
} // namespace qs::debuginfo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue