QRencode: Add fallback for Linux distros that don't provide unversioned library symlinks

This commit is contained in:
Felix Kauselmann 2022-10-15 15:26:19 +02:00
parent 569a699c1d
commit 17b0d357b1
2 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch)
* Fixed going forward history navigation.
* Continue Reading view that it is shown for the root folder.
* UI gets updated when YACReaderLibrary gets updates from YACReader or YACReader for iOS.
* Linux: Add fallback for dynamically loading libqrencode on distros that don't provide unversioned library symlinks
## 9.9.2

View File

@ -303,6 +303,13 @@ QrEncoder::QrEncoder()
QLibrary encoder(QCoreApplication::applicationDirPath() + "/utils/libqrencode.dylib");
#else
QLibrary encoder("qrencode");
#ifdef Q_OS_UNIX
encoder.load();
// Fallback - this loads libqrencode.4.x.x.so when libqrencode.so is not available
if (!encoder.isLoaded()) {
encoder.setFileNameAndVersion("qrencode", 4);
}
#endif
#endif
QRcode_encodeString8bit = (_QRcode_encodeString8bit)encoder.resolve("QRcode_encodeString8bit");
QRcode_free = (_QRcode_free)encoder.resolve("QRcode_free");