public static VirtualFile createDirectoryIfMissing(@Nullable VirtualFile parent, @NotNull String relativePath) throws IOException {
    if (parent == null) {
      return createDirectoryIfMissing(LocalFileSystem.getInstance(), relativePath);
    }

    for (String each : StringUtil.split(relativePath, "/")) {
      VirtualFile child = parent.findChild(each);
      if (child == null) {
        child = parent.createChildDirectory(parent.getFileSystem(), each);
      }
      parent = child;
    }
    return parent;
  }
public static VirtualFile createDirectoryIfMissing(@Nullable VirtualFile parent, @NotNull String relativePath)