| 1128 | } |
| 1129 | |
| 1130 | QString which(const std::string& name) { |
| 1131 | std::vector<char> command(4096); |
| 1132 | snprintf(command.data(), command.size()-1, "which %s", name.c_str()); |
| 1133 | |
| 1134 | auto* proc = popen(command.data(), "r"); |
| 1135 | |
| 1136 | if (proc == nullptr) |
| 1137 | throw std::runtime_error("Failed to start process for which"); |
| 1138 | |
| 1139 | std::vector<char> outBuf(4096); |
| 1140 | |
| 1141 | fread(outBuf.data(), sizeof(char), outBuf.size()-1, proc); |
| 1142 | |
| 1143 | pclose(proc); |
| 1144 | |
| 1145 | QString rv(outBuf.data()); |
| 1146 | |
| 1147 | rv.replace("\n", ""); |
| 1148 | |
| 1149 | return rv; |
| 1150 | } |
| 1151 | |
| 1152 | void checkAuthorizationAndShowDialogIfNecessary(const QString& path, const QString& question) { |
| 1153 | const uint32_t ownUid = getuid(); |
no outgoing calls
no test coverage detected