Skip to content

Commit

Permalink
Cleanup. Move NPCAP_DIR to static block.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewauclair committed Dec 4, 2023
1 parent 58155ea commit cfe8482
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ class NativeMappings {
private static final Map<String, Object> NATIVE_LOAD_LIBRARY_OPTIONS =
new HashMap<String, Object>();

static final File NPCAP_DIR = Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile();

static {
if (Platform.isWindows() && System.getProperty("jna.library.path") == null) {
if (NPCAP_DIR.exists()) {
NativeLibrary.addSearchPath("wpcap", NPCAP_DIR.getAbsolutePath());
}
File NPCAP_DIR = Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile();

if (Platform.isWindows() && System.getProperty("jna.library.path") == null && NPCAP_DIR.exists()) {
NativeLibrary.addSearchPath("wpcap", NPCAP_DIR.getAbsolutePath());
}
}

Expand Down

0 comments on commit cfe8482

Please sign in to comment.