File tree Expand file tree Collapse file tree
src/main/java/org/arkecosystem/crypto/signature/bls Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments