Skip to content

Commit 972ab8e

Browse files
committed
wip
1 parent 4164da8 commit 972ab8e

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

  • src/main/java/org/arkecosystem/crypto/signature/bls

src/main/java/org/arkecosystem/crypto/signature/bls/JNIEnv.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ public JNIEnv() {
2929
}
3030

3131
private Boolean sourceExist(String sourceName) {
32-
File f = new File("." + File.separator + sourceName);
33-
return f.exists();
32+
String[] libraryPaths = System.getProperty("java.library.path").split(File.pathSeparator);
33+
for (String path : libraryPaths) {
34+
File f = new File(path, sourceName);
35+
if (f.exists()) {
36+
return true;
37+
}
38+
}
39+
return false;
3440
}
35-
41+
3642
public void prepare() {
3743
for (String s : sources) {
3844
copy(s);
@@ -44,14 +50,15 @@ public Boolean copy(String sourceName) {
4450
return true;
4551
} else {
4652
try {
47-
File f = new File("." + File.separator + sourceName);
53+
String[] libraryPaths = System.getProperty("java.library.path").split(File.pathSeparator);
54+
File f = new File(libraryPaths[0], sourceName); // Using the first path in java.library.path
4855
if (!f.exists()) {
4956
f.createNewFile();
5057
System.out.println("[JNIDEV]:DEFAULT JNI INITION:" + sourceName);
5158
}
5259
FileOutputStream os = new FileOutputStream(f);
5360

54-
InputStream is = getClass().getResourceAsStream(sourceName);
61+
InputStream is = getClass().getResourceAsStream("/" + sourceName); // Modified to add leading slash
5562
if (is == null) {
5663
os.close();
5764
return false;

0 commit comments

Comments
 (0)