public static Map<String, String> readManifest(final File location) throws IOException {

    if (location.isFile()) {
      final ZipFile zip = ZipUtil.open(location);

      try {
        return readManifest(zip);
      } finally {
        try {
          zip.close();
        } catch (IOException e) {
        }
      }
    } else {
      final File manifestFile = new File(location, MANIFEST_PATH);

      if (manifestFile.exists()) {
        final InputStream in = new FileInputStream(manifestFile);

        try {
          return readManifest(new BufferedInputStream(in));
        } finally {
          try {
            in.close();
          } catch (IOException e) {
          }
        }
      } else {
        return Collections.emptyMap();
      }
    }
  }