private List < File > locateModules ( ) { File [ ] files = modRoot . listFiles ( ) ; List < File > modFiles = new ArrayList <> ( ) ; for ( File file : files ) { if ( file . isDirectory ( ) ) { // Check to determine whether the directory is a valid module directory. boolean isValid = true ; try { new ModuleIdentifier ( file . getName ( ) ) ; } catch ( Exception e ) { isValid = false ; } // If the directory is a valid module name then check for a mod.json file. if ( isValid ) { File modJson = new File ( file , MOD_JSON_FILE ) ; if ( modJson . exists ( ) ) { modFiles . add ( file ) ; } } } } return modFiles ; }
Locates all modules in the local repository .