Android: don't add lib prefix to loaded libs unconditionally

Some libs don't necessarily have the lib prefix in their names,
3rd party libs and Qt for Python might have that, so no need to
always add that prefix to loaded libs is the lib name already
contains a .so suffix.

Fixes: QTBUG-123286
Change-Id: Ib65215d9b4410c5c9e00aa0642f48ab45c92fe03
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 4bb4d015f7e855015f8dc32d658518d5ec3556bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2ba01c7ace47c7b8f4b9e1baf8e4b5e2eeb87703)
This commit is contained in:
Assam Boudjelthia 2024-03-13 14:34:36 +04:00 committed by Qt Cherry-pick Bot
parent c7cddc92ff
commit 9057431efb

View File

@ -495,10 +495,13 @@ public abstract class QtLoader {
ArrayList<String> absolutePathLibraries = new ArrayList<>();
for (String libName : libraries) {
if (!libName.startsWith("lib"))
libName = "lib" + libName;
if (!libName.endsWith(".so"))
// Add lib and .so to the lib name only if it doesn't already end with .so,
// this means some names don't necessarily need to have the lib prefix
if (!libName.endsWith(".so")) {
libName = libName + ".so";
libName = "lib" + libName;
}
File file = new File(m_nativeLibrariesDir + libName);
absolutePathLibraries.add(file.getAbsolutePath());
}