MCPcopy Create free account
hub / github.com/IJHack/QtPass / configIsValid

Method configIsValid

src/util.cpp:191–213  ·  view source on GitHub ↗

* @brief Checks whether the current QtPass configuration is valid. * @example * bool result = Util::configIsValid(); * std::cout << std::boolalpha << result << std::endl; // Expected output: true * or false * * @return bool - True if the configuration file exists and the required * executable is available; otherwise false. */

Source from the content-addressed store, hash-verified

189 * executable is available; otherwise false.
190 */
191auto Util::configIsValid() -> bool {
192 const QString configFilePath =
193 QDir(QtPassSettings::getPassStore()).filePath(".gpg-id");
194 if (!QFile(configFilePath).exists()) {
195 return false;
196 }
197
198 const QString executable = QtPassSettings::isUsePass()
199 ? QtPassSettings::getPassExecutable()
200 : QtPassSettings::getGpgExecutable();
201
202 if (executable.startsWith(QStringLiteral("wsl "))) {
203 QString out;
204 QString err;
205 if (Executor::executeBlocking(QStringLiteral("wsl"),
206 {QStringLiteral("--version")}, &out,
207 &err) == 0 &&
208 !out.isEmpty() && err.isEmpty()) {
209 return true;
210 }
211 }
212 return QFile(executable).exists();
213}
214
215/**
216 * @brief Returns a directory path derived from a model index, optionally

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected