Skip to content

Commit 2890657

Browse files
committed
ignore AccessDeniedException
1 parent 1d72868 commit 2890657

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

opus-jni-java/src/main/java/net/labymod/opus/OpusCodec.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.File;
44
import java.io.IOException;
55
import java.io.InputStream;
6+
import java.nio.file.AccessDeniedException;
67
import java.nio.file.Files;
78
import java.nio.file.Path;
89
import java.nio.file.StandardCopyOption;
@@ -278,7 +279,11 @@ public static void loadNative(File directory, boolean allowArm) throws IOExcepti
278279
}
279280

280281
Path destination = directory.toPath().resolve(nativeLibraryName);
281-
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
282+
try {
283+
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
284+
} catch (AccessDeniedException ignored) {
285+
// The file already exists, or we don't have permission to write to the directory
286+
}
282287
System.load(new File(directory, nativeLibraryName).getAbsolutePath());
283288
}
284289

0 commit comments

Comments
 (0)