public static @Nullable VirtualFile createDirectoryIfMissing(@NotNull VirtualFileSystem fileSystem,
                                                               @NotNull String directoryPath) throws IOException {
    String path = FileUtil.toSystemIndependentName(directoryPath);
    VirtualFile file = fileSystem.refreshAndFindFileByPath(path);
    if (file != null) {
      return file;
    }

    int pos = path.lastIndexOf('/');
    if (pos < 0) {
      return null;
    }

    String parentPath = StringUtil.defaultIfEmpty(path.substring(0, pos), "/");
    VirtualFile parent = createDirectoryIfMissing(fileSystem, parentPath);
    if (parent == null) {
      return null;
    }

    String dirName = path.substring(pos + 1);
    VirtualFile child = parent.findChild(dirName);
    if (child != null && child.isDirectory()) {
      return child;
    }
    return parent.createChildDirectory(fileSystem, dirName);
  }
public static @Nullable VirtualFile createDirectoryIfMissing(@NotNull VirtualFileSystem fileSystem,
                                                               @NotNull String directoryPath)