MCPcopy Create free account
hub / github.com/TheAssassin/AppImageLauncher / which

Function which

src/shared/shared.cpp:1130–1150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1128}
1129
1130QString 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
1152void checkAuthorizationAndShowDialogIfNecessary(const QString& path, const QString& question) {
1153 const uint32_t ownUid = getuid();

Calls

no outgoing calls

Tested by

no test coverage detected