public static PsiDirectory createSubdirectories(final String subDirName, PsiDirectory baseDirectory, final String delim) throws IncorrectOperationException {
    StringTokenizer tokenizer = new StringTokenizer(subDirName, delim);
    PsiDirectory dir = baseDirectory;
    boolean firstToken = true;
    while (tokenizer.hasMoreTokens()) {
      String dirName = tokenizer.nextToken();
      if (tokenizer.hasMoreTokens()) {
        if (firstToken && "~".equals(dirName)) {
          final VirtualFile userHomeDir = VfsUtil.getUserHomeDir();
          if (userHomeDir == null) throw new IncorrectOperationException("User home directory not found");
          final PsiDirectory directory1 = baseDirectory.getManager().findDirectory(userHomeDir);
          if (directory1 == null) throw new IncorrectOperationException("User home directory not found");
          dir = directory1;
          continue;
        }
        else if ("..".equals(dirName)) {
          dir = dir.getParentDirectory();
          if (dir == null) throw new IncorrectOperationException("Not a valid directory");
          continue;
        }
        else if (".".equals(dirName)) {
          continue;
        }
        PsiDirectory existingDir = dir.findSubdirectory(dirName);
        if (existingDir != null) {
          dir = existingDir;
          continue;
        }
      }
      dir = dir.createSubdirectory(dirName);
      firstToken = false;
    }
    return dir;
  }
public static PsiDirectory createSubdirectories(final String subDirName, PsiDirectory baseDirectory, final String delim)