Changeset 7248 in josm for trunk/src/org/openstreetmap/josm/io/FileWatcher.java
- Timestamp:
- 2014-06-14T12:40:50+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/FileWatcher.java
r7244 r7248 59 59 throw new IllegalStateException("File watcher is not available"); 60 60 } 61 try (MirroredInputStream mis = style.getMirroredInputStream()) { 62 // Get underlying file 63 File file = mis.getFile(); 64 if (file == null) { 65 throw new IllegalArgumentException("Style "+style+" does not have a local file"); 66 } 67 // Get parent directory as WatchService allows only to monitor directories, not single files 68 File dir = file.getParentFile(); 69 if (dir == null) { 70 throw new IllegalArgumentException("Style "+style+" does not have a parent directory"); 71 } 72 synchronized(this) { 73 // Register directory. Can be called several times for a same directory without problem 74 // (it returns the same key so it should not send events several times) 75 dir.toPath().register(watcher, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE); 76 styleMap.put(file.toPath(), style); 77 } 61 CachedFile cf = style.getCachedFile(); 62 // Get underlying file 63 File file = cf.getFile(); 64 if (file == null) { 65 throw new IllegalArgumentException("Style "+style+" does not have a local file"); 66 } 67 // Get parent directory as WatchService allows only to monitor directories, not single files 68 File dir = file.getParentFile(); 69 if (dir == null) { 70 throw new IllegalArgumentException("Style "+style+" does not have a parent directory"); 71 } 72 synchronized(this) { 73 // Register directory. Can be called several times for a same directory without problem 74 // (it returns the same key so it should not send events several times) 75 dir.toPath().register(watcher, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE); 76 styleMap.put(file.toPath(), style); 78 77 } 79 78 }
Note:
See TracChangeset
for help on using the changeset viewer.