Skip to content

Commit 37ed368

Browse files
committed
Improve
1 parent 4bfe828 commit 37ed368

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

circle.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ machine:
55

66
dependencies:
77
pre:
8-
- chmod a+x gradlew
98
- cmake jni
109
override:
11-
- ./gradlew dependencies
10+
- bash gradlew dependencies
1211
- cmake --build . --target all -- -j 8
1312
#
1413

@@ -17,7 +16,7 @@ test:
1716
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
1817
- bash <(curl -s https://codecov.io/bash)
1918
override:
20-
- ./gradlew check --info
19+
- bash gradlew check --info
2120
#
2221

2322
general:

src/main/java/org/algo4j/util/Loader.java

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.algo4j.util;
22

3-
import org.jetbrains.annotations.Contract;
4-
import org.jetbrains.annotations.NonNls;
53
import org.jetbrains.annotations.NotNull;
64

75
import java.io.File;
@@ -14,7 +12,7 @@
1412
*/
1513
@SuppressWarnings("WeakerAccess")
1614
public final class Loader {
17-
public final static String JNI_LIB_NAME;
15+
public final static @NotNull String JNI_LIB_NAME;
1816
private static boolean loaded = false;
1917

2018
/*
@@ -25,24 +23,9 @@ public final class Loader {
2523
loadJni();
2624
}
2725

28-
@NotNull
29-
@Contract(pure = true)
30-
private static String libraryName(@NonNls @NotNull String libName) {
31-
String ___ = System.getProperty("os.name");
32-
String fileName;
33-
if (___.contains("Linux"))
34-
fileName = libName + ".so";
35-
else if (___.contains("Windows"))
36-
fileName = libName + ".dll";
37-
else // if (___.contains("OSX"))
38-
fileName = libName + ".dylib";
39-
// else fileName = libName;
40-
return new File(fileName).getAbsolutePath();
41-
}
42-
4326
public static void loadJni() {
4427
if (!loaded) {
45-
System.load(libraryName(JNI_LIB_NAME));
28+
System.load(new File(System.mapLibraryName(JNI_LIB_NAME)).getAbsolutePath());
4629
loaded = true;
4730
}
4831
}

0 commit comments

Comments
 (0)