Added TEMP_DIR to OS.

This commit is contained in:
nathan 2017-06-26 14:06:07 +02:00
parent ba593bbf9e
commit a9e5ebb168

View File

@ -15,10 +15,6 @@
*/ */
package dorkbox.network.util; package dorkbox.network.util;
import dorkbox.network.Server;
import dorkbox.util.OS;
import io.netty.util.internal.PlatformDependent;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
@ -26,6 +22,10 @@ import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.rmi.server.ExportException; import java.rmi.server.ExportException;
import dorkbox.network.Server;
import dorkbox.util.OS;
import io.netty.util.internal.PlatformDependent;
/** /**
* Loads the specified library, extracting it from the jar, if necessary * Loads the specified library, extracting it from the jar, if necessary
*/ */
@ -47,9 +47,8 @@ class NativeLoader {
} }
final String outputFileName = destinationPrefix + "." + Server.getVersion() + suffix; final String outputFileName = destinationPrefix + "." + Server.getVersion() + suffix;
final String tempDir = System.getProperty("java.io.tmpdir");
final File file = new File(tempDir, outputFileName); final File file = new File(OS.TEMP_DIR, outputFileName);
if (!file.canRead()) { if (!file.canRead()) {
ClassLoader loader = PlatformDependent.getClassLoader(classLoaderClass); ClassLoader loader = PlatformDependent.getClassLoader(classLoaderClass);
URL url = loader.getResource(sourceFileName); URL url = loader.getResource(sourceFileName);