QString Util::findBinaryInPath(QString binary) { initialiseEnvironment(); QString ret = ""; binary.prepend(QDir::separator()); if (_env.contains("PATH")) { QString path = _env.value("PATH"); QStringList entries; #ifndef Q_OS_WIN entries = path.split(':'); if (entries.length() < 2) { #endif entries = path.split(';'); #ifndef Q_OS_WIN } #endif foreach(QString entry, entries) { QScopedPointer<QFileInfo> qfi(new QFileInfo(entry.append(binary))); #ifdef Q_OS_WIN if (!qfi->exists()) qfi.reset(new QFileInfo(entry.append(".exe"))); #endif qDebug() << entry; if (!qfi->isExecutable()) continue; ret = qfi->absoluteFilePath(); break; }
/** * @brief Util::findPasswordStore * @return */ QString Util::findPasswordStore() { QString path; initialiseEnvironment(); if (_env.contains("PASSWORD_STORE_DIR")) { path = _env.value("PASSWORD_STORE_DIR"); } else { path = QDir::homePath()+"/.password-store/"; } return Util::normalizeFolderPath(path); }
/** * @brief Util::findPasswordStore * @return */ QString Util::findPasswordStore() { QString path; initialiseEnvironment(); if (_env.contains("PASSWORD_STORE_DIR")) { path = _env.value("PASSWORD_STORE_DIR"); } else { #ifdef Q_OS_WIN path = QDir::homePath() + QDir::separator() + "password-store" + QDir::separator(); #else path = QDir::homePath() + QDir::separator() + ".password-store" + QDir::separator(); #endif } return Util::normalizeFolderPath(path); }