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
public void run() {
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(
watcher,
StandardWatchEventKinds.ENTRY_CREATE,