Skip to content

Commit c057b94

Browse files
committed
Add ability to specify the Zstd temp folder with a property
The new property is `ZstdTempFolder` and it is used to extract the native library and load it from there. Addresses: #315
1 parent 0f657c0 commit c057b94

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/com/github/luben/zstd/util/Native.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public enum Native {
1313
;
1414

1515
private static final String nativePathOverride = "ZstdNativePath";
16+
private static final String tempFolderOverride = "ZstdTempFolder";
1617
private static final String libnameShort = "zstd-jni-" + ZstdVersion.VERSION;
1718
private static final String libname = "lib" + libnameShort;
1819
private static final String errorMsg = "Unsupported OS/arch, cannot find " +
@@ -83,7 +84,12 @@ public Void run() {
8384
}
8485

8586
public static synchronized void load() {
86-
load(null);
87+
String tempFolder = System.getProperty(tempFolderOverride);
88+
if (tempFolder == null) {
89+
load(null);
90+
} else {
91+
load(new File(tempFolder));
92+
}
8793
}
8894

8995
public static synchronized void load(final File tempFolder) {

0 commit comments

Comments
 (0)