private static File unpackNar(final File nar,final File baseWorkingDirectory) throws IOException {
  final File narWorkingDirectory=new File(baseWorkingDirectory,nar.getName() + "-unpacked");
  if (!narWorkingDirectory.exists()) {
    unpack(nar,narWorkingDirectory,calculateMd5sum(nar));
  }
 else {
    final byte[] narMd5=calculateMd5sum(nar);
    final File workingHashFile=new File(narWorkingDirectory,HASH_FILENAME);
    if (!workingHashFile.exists()) {
      FileUtils.deleteFile(narWorkingDirectory,true);
      unpack(nar,narWorkingDirectory,narMd5);
    }
 else {
      final byte[] hashFileContents=Files.readAllBytes(workingHashFile.toPath());
      if (!Arrays.equals(hashFileContents,narMd5)) {
        logger.info("Contents of nar {} have changed. Reloading.",new Object[]{nar.getAbsolutePath()});
        FileUtils.deleteFile(narWorkingDirectory,true);
        unpack(nar,narWorkingDirectory,narMd5);
      }
    }
  }
  return narWorkingDirectory;
}

private static File unpackNar ( final File nar , final File baseWorkingDirectory ) throws IOException { final File narWorkingDirectory = new File ( baseWorkingDirectory , nar . getName ( ) + "-unpacked" ) ; if ( ! narWorkingDirectory . exists ( ) ) { unpack ( nar , narWorkingDirectory , calculateMd5sum ( nar ) ) ; } else { final byte [ ] narMd5 = calculateMd5sum ( nar ) ; final File workingHashFile = new File ( narWorkingDirectory , HASH_FILENAME ) ; if ( ! workingHashFile . exists ( ) ) { FileUtils . deleteFile ( narWorkingDirectory , true ) ; unpack ( nar , narWorkingDirectory , narMd5 ) ; } else { final byte [ ] hashFileContents = Files . readAllBytes ( workingHashFile . toPath ( ) ) ; if ( ! Arrays . equals ( hashFileContents , narMd5 ) ) { logger . info ( "Contents of nar {} have changed. Reloading." , new Object [ ] { nar . getAbsolutePath ( ) } ) ; FileUtils . deleteFile ( narWorkingDirectory , true ) ; unpack ( nar , narWorkingDirectory , narMd5 ) ; } } } return narWorkingDirectory ; }
unpacks the specified nar into the specified base working directory .
