MCPcopy Create free account
hub / github.com/questdb/questdb / getNativeLibsDir

Method getNativeLibsDir

core/src/main/java/io/questdb/std/Os.java:276–308  ·  view source on GitHub ↗
(String libName)

Source from the content-addressed store, hash-verified

274 }
275
276 @Nullable
277 public static String getNativeLibsDir(String libName) {
278 // the property name must be synced with questdb.sh and docker-entrypoint.sh
279 String libsDir = System.getProperty("questdb.libs.dir");
280 if (libsDir != null) {
281 // hooray, we are running from a distribution and the lib dir was set explicitly!
282 return libsDir;
283 }
284
285 // let's try to detect the lib location
286 if (!isJlinkRuntime()) {
287 // we are not in a jlink-ed runtime image -> we have to extract the native libs from the jar
288 return null;
289 }
290
291 // In jlink-ed runtime images, java.home points to the runtime image root,
292 // modules and native libs are in $JAVA_HOME/lib/
293 String javaHome = System.getProperty("java.home");
294 if (javaHome == null) {
295 return null;
296 }
297
298 java.nio.file.Path libDir = Paths.get(javaHome, "lib");
299 if (!libDir.toFile().isDirectory()) {
300 return null;
301 }
302
303 java.nio.file.Path libPath = libDir.resolve(libName);
304 if (!libPath.toFile().exists()) {
305 return null;
306 }
307 return libDir.toString();
308 }
309
310 private static boolean tryLoadFromDistribution(String cxxLibName, String rustLibName) {
311 String libsDir = getNativeLibsDir(cxxLibName);

Callers 1

Calls 5

isJlinkRuntimeMethod · 0.95
getPropertyMethod · 0.80
getMethod · 0.65
existsMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected