private boolean shouldWritePackageInfo ( File directory ) { if ( ! directory . isDirectory ( ) ) return false ; if ( ! directory . exists ( ) ) return false ; // legacy behavior: if mPackageRootDir is a sub-dir of mSrcRootPath, an explicit package was specified if ( isChild ( new File ( mSrcRootPath ) , mPackageRootDir ) ) { // return true if 'directory' passed in equals() or is a child of mPackageRootDir return mPackageRootDir . equals ( directory ) || isChild ( mPackageRootDir , directory ) ; } else { // only return true if 'directory' passed in contains at least one file File [ ] files = directory . listFiles ( new FileFilter ( ) { public boolean accept ( File pathname ) { return pathname . isFile ( ) ; } } ) ; return files != null && files . length > 0 ; } }
Tests if a PackageInfo . java file should be written in the directory passed in .