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) {