public String getMergedJsonFile ( final VFS vfs , final ResourceResolver resolver , final String in ) throws IOException { final VFile file = vfs . find ( "/__temp__json__input" ) ; final List < Resource > resources = getJsonSourceFiles ( resolver . resolve ( in ) ) ; // Hack which tries to replace all non-js sources with js sources in case of // mixed json-input file boolean foundJs = false ; boolean foundNonJs = false ; for ( final Resource resource : resources ) { foundJs |= FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ; foundNonJs |= ! FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ; } if ( foundJs && foundNonJs ) { for ( int i = 0 , n = resources . size ( ) ; i < n ; i ++ ) { final Resource resource = resources . get ( i ) ; if ( ! FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ) { final Resource jsResource = resource . getResolver ( ) . resolve ( FilenameUtils . getName ( FilenameUtils . removeExtension ( resource . getPath ( ) ) + ".js" ) ) ; resources . add ( resources . indexOf ( resource ) , jsResource ) ; resources . remove ( resource ) ; } } } VFSUtils . write ( file , merge ( resources ) ) ; return file . getPath ( ) ; }
Returns a merged temporary file with all contents listed in the given json file paths .