Skip to content

Commit cc62112

Browse files
committed
Fix system property name
1 parent edd905b commit cc62112

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ On all platforms except macOS, the library internally uses the JDK default imple
6363

6464
On macOS, the library internally uses our custom `WatchService` implementation based on macOS's native [file system event streams](https://developer.apple.com/documentation/coreservices/file_system_events?language=objc) (using JNA).
6565
Generally, it offers better performance than the JDK default implementation (because the latter uses a polling loop to detect changes only once every two seconds).
66-
To force the library to use the JDK default implementation on macOS, set system property `engineering.swat.watch.impl` to `default`.
66+
To force the library to use the JDK default implementation on macOS, set system property `engineering.swat.java-watch.mac` to `jdk`.
6767

6868
## Related work
6969

src/main/java/engineering/swat/watch/impl/jdk/JDKPoller.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,22 @@ public Watchable newWatchable(Path path) {
190190
static final Platform CURRENT = current(); // Assumption: the platform doesn't change
191191

192192
private static Platform current() {
193-
var key = "engineering.swat.watch.impl";
194-
var val = System.getProperty(key);
195-
if (val != null) {
196-
if (val.equals("mac")) {
197-
return MAC;
198-
} else if (val.equals("default")) {
199-
return DEFAULT;
200-
} else {
201-
logger.warn("Unexpected value \"{}\" for system property \"{}\". Using value \"default\" instead.", val, key);
202-
return DEFAULT;
193+
if (com.sun.jna.Platform.isMac()) {
194+
var key = "engineering.swat.java-watch.mac";
195+
var val = System.getProperty(key);
196+
if (val != null) {
197+
if (val.equals("jna")) {
198+
return MAC;
199+
} else if (val.equals("jdk")) {
200+
return DEFAULT;
201+
} else {
202+
logger.warn("Unexpected value \"{}\" for system property \"{}\". Using value \"jdk\" instead.", val, key);
203+
return DEFAULT;
204+
}
203205
}
204206
}
205207

206-
return com.sun.jna.Platform.isMac() ? MAC : DEFAULT;
208+
return DEFAULT;
207209
}
208210

209211
static Platform get() {

0 commit comments

Comments
 (0)