Skip to content

Commit 878193e

Browse files
authored
update to 0.2.3
update to 0.2.3
2 parents a350a16 + 3159ce9 commit 878193e

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ To include `xdagj-native-randomx` in your project, add the following dependency
115115
<dependency>
116116
<groupId>io.xdag</groupId>
117117
<artifactId>xdagj-native-randomx</artifactId>
118-
<version>0.2.2</version>
118+
<version>0.2.3</version>
119119
</dependency>
120120
```
121121

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.xdag</groupId>
88
<artifactId>xdagj-native-randomx</artifactId>
9-
<version>0.2.2</version>
9+
<version>0.2.3</version>
1010

1111
<name>xdagj-native-randomx</name>
1212
<description>A Java RandomX Library For XDAGJ</description>

src/main/java/io/xdag/crypto/randomx/RandomXLibraryLoader.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,22 @@ private static File extractAndLoadNativeLibrary() throws IOException, IllegalSta
138138
}
139139

140140
String mappedLibName = System.mapLibraryName(libraryLogicalName);
141-
String tempFilePrefix = mappedLibName.substring(0, mappedLibName.lastIndexOf('.'));
142-
String tempFileSuffix = mappedLibName.substring(mappedLibName.lastIndexOf('.'));
141+
File tempFile;
142+
143+
if (os.contains("win")) {
144+
// Use a fixed file name under Windows: randomx.dll
145+
Path tempDir = Files.createTempDirectory("randomx-");
146+
tempDir.toFile().deleteOnExit();
147+
tempFilePath = tempDir.resolve("randomx.dll"); // Fixed name
148+
} else {
149+
// Linux and macOS uses the default temporary files policy
150+
String tempFilePrefix = mappedLibName.substring(0, mappedLibName.lastIndexOf('.'));
151+
String tempFileSuffix = mappedLibName.substring(mappedLibName.lastIndexOf('.'));
152+
tempFilePath = Files.createTempFile(tempFilePrefix + "-", tempFileSuffix);
153+
}
154+
155+
tempFile = tempFilePath.toFile();
143156

144-
tempFilePath = Files.createTempFile(tempFilePrefix + "-", tempFileSuffix);
145-
File tempFile = tempFilePath.toFile();
146157
tempFile.deleteOnExit();
147158

148159
Files.copy(libStream, tempFilePath, StandardCopyOption.REPLACE_EXISTING);
4.37 KB
Binary file not shown.
11.9 KB
Binary file not shown.
321 KB
Binary file not shown.

0 commit comments

Comments
 (0)