mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
upgrade to jnotify 0.94 (patched) for 64-bit support, and improve error reporting in tests
- add a UnixRemovableDriveMonitor.checkEnabled to pre-emptively check if it's loaded - os.arch is always x86,x86_64 on windows, i386,amd64 on linux - source: http://www.java-gaming.org/index.php/topic,14110 - we'll deal with freebsd support when we come to it, jnotify doesn't even do this atm
This commit is contained in:
@@ -19,7 +19,27 @@ JNotifyListener {
|
||||
|
||||
protected abstract String[] getPathsToWatch();
|
||||
|
||||
final private static Throwable loadError = tryLoad();
|
||||
|
||||
private static Throwable tryLoad() {
|
||||
try {
|
||||
Class.forName("net.contentobjects.jnotify.JNotify");
|
||||
return null;
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
return e;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkEnabled() throws IOException {
|
||||
if (loadError != null) {
|
||||
throw new IOException("JNotify not loaded", loadError);
|
||||
}
|
||||
}
|
||||
|
||||
public void start(Callback callback) throws IOException {
|
||||
checkEnabled();
|
||||
List<Integer> watches = new ArrayList<Integer>();
|
||||
int mask = JNotify.FILE_CREATED;
|
||||
for(String path : getPathsToWatch()) {
|
||||
@@ -36,6 +56,7 @@ JNotifyListener {
|
||||
}
|
||||
|
||||
public void stop() throws IOException {
|
||||
checkEnabled();
|
||||
List<Integer> watches;
|
||||
synchronized(this) {
|
||||
assert started;
|
||||
|
||||
Reference in New Issue
Block a user