From 3781fcc83902bbcbeba6502681ea75992f69278e Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Sun, 3 May 2026 21:18:06 +0300 Subject: [PATCH] Fix findQmlImportScanner() on FreeBSD We don't install the qmlimportscanner executable into public location, so add a bit of extra logic to locate it. --- src/qml.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/qml.cpp b/src/qml.cpp index 3d588e5..1112ae3 100644 --- a/src/qml.cpp +++ b/src/qml.cpp @@ -1,6 +1,10 @@ // system headers #include +#ifdef __FreeBSD__ +#include +#endif + // library includes #include #include @@ -22,7 +26,20 @@ using namespace nlohmann; namespace fs = std::filesystem; fs::path findQmlImportScanner() { - return which("qmlimportscanner"); + auto path = which("qmlimportscanner"); +#ifdef __FreeBSD__ + int mib[2]; + char buf[PATH_MAX]; + size_t len = PATH_MAX; + + mib[0] = CTL_USER; + mib[1] = USER_LOCALBASE; + if (::sysctl(mib, 2, buf, &len, NULL, 0) != 0) + return path; + + path = which(std::string(buf) + "/libexec/qt6/qmlimportscanner"); +#endif + return path; } std::string runQmlImportScanner(const std::vector &sourcesPaths, const std::vector &qmlImportPaths) {