android: Avoid a ClosedWatchServiceException.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m40s

This commit is contained in:
Cory McWilliams 2024-09-28 23:25:28 -04:00
parent a821d895c5
commit 195920e476

View File

@ -99,7 +99,8 @@ public class TildeFriendsActivity extends Activity {
@Override @Override
public void run() { public void run() {
Log.w("tildefriends", "Watching for changes in: " + getFilesDir().toString()); Log.w("tildefriends", "Watching for changes in: " + getFilesDir().toString());
try (WatchService watcher = FileSystems.getDefault().newWatchService()) { try {
WatchService watcher = FileSystems.getDefault().newWatchService();
Paths.get(getFilesDir().toString()).register( Paths.get(getFilesDir().toString()).register(
watcher, watcher,
StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_CREATE,