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
Pick-to: 6.7 6.7.0
Change-Id: Ib65215d9b4410c5c9e00aa0642f48ab45c92fe03
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This commit is contained in:
Assam Boudjelthia 2024-03-13 14:34:36 +04:00
parent 08e6d4b43d
commit 4bb4d015f7

View File

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