public Path normalizeOutputPath ( FileResource resource ) { Path resourcePath = resource . getPath ( ) ; Path rel = Optional . ofNullable ( ( contentDir . relativize ( resourcePath ) ) . getParent ( ) ) // . orElseGet ( ( ) -> resourcePath . getFileSystem ( ) . getPath ( "" ) ) ; String finalOutput = rel . resolve ( finalOutputName ( resource ) ) . toString ( ) ; // outputDir and contentDir can have different underlying FileSystems return outputDir . resolve ( finalOutput ) ; }
Generate the output path given the resource and the output dir .