* @brief Reads the macOS IOPlatformUUID from the IO registry; only the * `key = "value"` shape is accepted, never a line lacking the '=' separator. */
| 89 | * `key = "value"` shape is accepted, never a line lacking the '=' separator. |
| 90 | */ |
| 91 | static QString readMacId(bool& complete) |
| 92 | { |
| 93 | QProcess process; |
| 94 | const auto ioregTool = resolveSystemTool({"/usr/sbin/ioreg"}, "ioreg"); |
| 95 | process.start(ioregTool, {"-rd1", "-c", "IOPlatformExpertDevice"}); |
| 96 | awaitTool(process); |
| 97 | QString output = process.readAllStandardOutput(); |
| 98 | |
| 99 | QString id; |
| 100 | QStringList lines = output.split("\n"); |
| 101 | for (const QString& line : std::as_const(lines)) { |
| 102 | if (line.contains("IOPlatformUUID")) { |
| 103 | const auto parts = line.split("="); |
| 104 | if (parts.size() >= 2) { |
| 105 | id = parts.last().trimmed(); |
| 106 | id.remove("\""); |
| 107 | } |
| 108 | break; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | complete = !id.isEmpty(); |
| 113 | return id; |
| 114 | } |
| 115 | #endif |
| 116 | |
| 117 | #if defined(Q_OS_WIN) |
no test coverage detected