Skip to content

Commit

Permalink
Move NPCAP_DIR to if block.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewauclair committed Dec 4, 2023
1 parent cfe8482 commit 6068d5a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ class NativeMappings {
new HashMap<String, Object>();

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

Expand Down

0 comments on commit 6068d5a

Please sign in to comment.