fix for linux not finding miniQt

adding miniQt to the LD_LIBRARY_PATH environment variable fixes the problem with linux not using miniQT when bundled with webpack like in the nodegui-starter template. this fixes https://github.com/nodegui/nodegui-starter/issues/229 fixes https://github.com/nodegui/nodegui/issues/972
This commit is contained in:
zecktos 2022-11-17 19:44:09 +01:00 committed by GitHub
parent b7d503fd39
commit 0c61e3bbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
#!/usr/bin/env node
var os = require('os');
var path = require('path');
var qodeConfig = require('@nodegui/qode');
var managePath = require('manage-path');
@ -11,6 +12,12 @@ var proc = require('child_process');
var alterPath = managePath(process.env);
alterPath.unshift(path.join(qtConfig.qtHome, 'bin'));
// Add Qt's lib to LD_LIBRARY_PATH so linux can find the libs when bundled with webpack
if(os.platform == 'linux') {
var oldLD_PATH = process.env.LD_LIBRARY_PATH ?? "";
process.env.LD_LIBRARY_PATH = oldLD_PATH + ":" + path.join(qtConfig.qtHome, 'lib');
}
var child = proc.spawn(qodeConfig.qodePath, process.argv.slice(2), {
stdio: 'inherit',
windowsHide: false,