/** This file is a copy of {@link ZipBundleFile#getFile(String, boolean)} with modifications. */
  @Override
  public File getFile(String path, boolean nativeCode) {
    File originalFile = delegate.getFile(path, nativeCode);

    if (originalFile == null) {
      return null;
    }
    if (!hasTransforms(path)) {
      return originalFile;
    }
    try {
      File nested = getExtractFile(path);
      if (nested != null) {
        if (nested.exists()) {
          /* the entry is already cached */
          if (Debug.DEBUG_GENERAL) {
            Debug.println("File already present: " + nested.getPath()); // $NON-NLS-1$
          }
          if (nested.isDirectory()) {
            // must ensure the complete directory is extracted (bug
            // 182585)
            extractDirectory(path);
          }
        } else {
          if (originalFile.isDirectory()) {
            if (!nested.mkdirs()) {
              if (Debug.DEBUG_GENERAL) {
                Debug.println("Unable to create directory: " + nested.getPath()); // $NON-NLS-1$
              }
              throw new IOException(
                  NLS.bind(
                      AdaptorMsg.ADAPTOR_DIRECTORY_CREATE_EXCEPTION, nested.getAbsolutePath()));
            }
            extractDirectory(path);
          } else {
            InputStream in = getEntry(path).getInputStream();
            if (in == null) {
              return null;
            }
            // if (in instanceof )
            /* the entry has not been cached */
            if (Debug.DEBUG_GENERAL) {
              Debug.println("Creating file: " + nested.getPath()); // $NON-NLS-1$
            }
            /* create the necessary directories */
            File dir = new File(nested.getParent());
            if (!dir.exists() && !dir.mkdirs()) {
              if (Debug.DEBUG_GENERAL) {
                Debug.println("Unable to create directory: " + dir.getPath()); // $NON-NLS-1$
              }
              throw new IOException(
                  NLS.bind(AdaptorMsg.ADAPTOR_DIRECTORY_CREATE_EXCEPTION, dir.getAbsolutePath()));
            }
            /* copy the entry to the cache */
            AdaptorUtil.readFile(in, nested);
            if (nativeCode) {
              setPermissions(nested);
            }
          }
        }

        return nested;
      }
    } catch (IOException e) {
      if (Debug.DEBUG_GENERAL) {
        Debug.printStackTrace(e);
      }
    }
    return null;
  }