private void addSubDirectory ( Path root , Path filePath ) throws IOException { String listener = getListenerRootPath ( root ) ; List < String > listeners = mSubDirectories . get ( listener ) ; if ( listeners != null ) { if ( mSubDirectories . get ( listener ) . contains ( filePath . toAbsolutePath ( ) ) ) { return ; } else { mSubDirectories . get ( listener ) . add ( filePath . toString ( ) ) ; } try { watchDir ( filePath . toFile ( ) ) ; } catch ( IOException e ) { throw new IOException ( "Could not watch the subdirectories." , e ) ; } } }
In this method a subdirectory is being added to the system and watched .