Skip to content

Commit 3781fcc

Browse files
committed
Fix findQmlImportScanner() on FreeBSD
We don't install the qmlimportscanner executable into public location, so add a bit of extra logic to locate it.
1 parent 511d51d commit 3781fcc

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/qml.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// system headers
22
#include <filesystem>
33

4+
#ifdef __FreeBSD__
5+
#include <sys/sysctl.h>
6+
#endif
7+
48
// library includes
59
#include <nlohmann/json.hpp>
610
#include <linuxdeploy/core/appdir.h>
@@ -22,7 +26,20 @@ using namespace nlohmann;
2226
namespace fs = std::filesystem;
2327

2428
fs::path findQmlImportScanner() {
25-
return which("qmlimportscanner");
29+
auto path = which("qmlimportscanner");
30+
#ifdef __FreeBSD__
31+
int mib[2];
32+
char buf[PATH_MAX];
33+
size_t len = PATH_MAX;
34+
35+
mib[0] = CTL_USER;
36+
mib[1] = USER_LOCALBASE;
37+
if (::sysctl(mib, 2, buf, &len, NULL, 0) != 0)
38+
return path;
39+
40+
path = which(std::string(buf) + "/libexec/qt6/qmlimportscanner");
41+
#endif
42+
return path;
2643
}
2744

2845
std::string runQmlImportScanner(const std::vector<std::filesystem::path> &sourcesPaths, const std::vector<fs::path> &qmlImportPaths) {

0 commit comments

Comments
 (0)