Skip to content

Commit

Permalink
ignore AccessDeniedException
Browse files Browse the repository at this point in the history
  • Loading branch information
LabyStudio committed Mar 6, 2023
1 parent 1d72868 commit 2890657
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion opus-jni-java/src/main/java/net/labymod/opus/OpusCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.AccessDeniedException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
Expand Down Expand Up @@ -278,7 +279,11 @@ public static void loadNative(File directory, boolean allowArm) throws IOExcepti
}

Path destination = directory.toPath().resolve(nativeLibraryName);
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
try {
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
} catch (AccessDeniedException ignored) {
// The file already exists, or we don't have permission to write to the directory
}
System.load(new File(directory, nativeLibraryName).getAbsolutePath());
}

Expand Down

0 comments on commit 2890657

Please sign in to comment.