Skip to content

Commit 0cb62c8

Browse files
committed
fix: specify search paths to avoid the pinentry notice on macOS
1 parent e45f112 commit 0cb62c8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/core/utils/GpgUtils.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,13 @@ auto GPGFRONTEND_CORE_EXPORT DecidePinentry() -> QString {
462462
QStringList preferred_list = {"pinentry-gnome3",
463463
"pinentry-qt"
464464
"pinentry-gtk2"};
465+
QStringList search_paths = {"/bin", "/usr/bin", "/usr/local/bin"}
465466
#elif defined(__APPLE__) && defined(__MACH__)
466467
QStringList preferred_list = {"pinentry-mac", "pinentry-qt"};
468+
QStringList search_paths = {"/opt/homebrew/bin", "/usr/local/bin"};
467469
#else
468470
QStringList preferred_list = {"pinentry-qt"};
471+
QStringList search_paths = {};
469472
#endif
470473

471474
if (IsFlatpakENV()) {
@@ -480,6 +483,15 @@ auto GPGFRONTEND_CORE_EXPORT DecidePinentry() -> QString {
480483
}
481484
}
482485

486+
if (search_paths.isEmpty()) return {};
487+
488+
for (const QString& name : preferred_list) {
489+
QString path = QStandardPaths::findExecutable(name, search_paths);
490+
if (!path.isEmpty()) {
491+
return path;
492+
}
493+
}
494+
483495
return {};
484496
}
485497
} // namespace GpgFrontend

0 commit comments

Comments
 (0)