Fix windows build
This commit is contained in:
parent
4d2f48d533
commit
14e95e29f3
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package it.tdlight.util;
|
||||
|
||||
import java.nio.file.AccessDeniedException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -263,7 +264,7 @@ public final class NativeLibraryLoader {
|
||||
// We delete the file immediately to free up resources as soon as possible,
|
||||
// and if this fails fallback to deleting on JVM exit.
|
||||
try {
|
||||
if (tmpFile != null && (!DELETE_NATIVE_LIB_AFTER_LOADING || !Files.deleteIfExists(tmpFile))) {
|
||||
if (tmpFile != null && (!DELETE_NATIVE_LIB_AFTER_LOADING || !deleteIfExists(tmpFile))) {
|
||||
tmpFile.toFile().deleteOnExit();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -272,6 +273,14 @@ public final class NativeLibraryLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean deleteIfExists(Path tmpFile) throws IOException {
|
||||
try {
|
||||
return Files.deleteIfExists(tmpFile);
|
||||
} catch (AccessDeniedException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOsx() {
|
||||
return Native.getOs().equals("osx");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user