@Nullable public VirtualFile findFileByRelativePath(@NotNull @NonNls String relPath){
  if (relPath.isEmpty())   return this;
  relPath=StringUtil.trimStart(relPath,"/");
  int index=relPath.indexOf('/');
  if (index < 0)   index=relPath.length();
  String name=relPath.substring(0,index);
  VirtualFile child;
  if (name.equals(".")) {
    child=this;
  }
 else   if (name.equals("..")) {
    if (is(VFileProperty.SYMLINK)) {
      final VirtualFile canonicalFile=getCanonicalFile();
      child=canonicalFile != null ? canonicalFile.getParent() : null;
    }
 else {
      child=getParent();
    }
  }
 else {
    child=findChild(name);
  }
  if (child == null)   return null;
  if (index < relPath.length()) {
    return child.findFileByRelativePath(relPath.substring(index + 1));
  }
  return child;
}

@ Nullable public VirtualFile findFileByRelativePath ( @ NotNull @ NonNls String relPath ) { if ( relPath . isEmpty ( ) ) return this ; relPath = StringUtil . trimStart ( relPath , "/" ) ; int index = relPath . indexOf ( '/' ) ; if ( index < 0 ) index = relPath . length ( ) ; String name = relPath . substring ( 0 , index ) ; VirtualFile child ; if ( name . equals ( "." ) ) { child = this ; } else if ( name . equals ( ".." ) ) { if ( is ( VFileProperty . SYMLINK ) ) { final VirtualFile canonicalFile = getCanonicalFile ( ) ; child = canonicalFile != null ? canonicalFile . getParent ( ) : null ; } else { child = getParent ( ) ; } } else { child = findChild ( name ) ; } if ( child == null ) return null ; if ( index < relPath . length ( ) ) { return child . findFileByRelativePath ( relPath . substring ( index + 1 ) ) ; } return child ; }
finds file by path relative to this file .
