@Override
  public LocalResourceId getCurrentDirectory() {
    if (isDirectory()) {
      return this;
    } else {
      Path path = getPath();
      Path parent = path.getParent();
      if (parent == null && path.getNameCount() == 1) {
        parent = Paths.get(".");
      }
      checkStateNotNull(parent, "Failed to get the current directory for path: [%s].", pathString);
      return fromPath(parent, true /* isDirectory */);
    }
  }
@Test
  public void testGetCurrentDirectoryInUnix() {
    // Tests for local files without the scheme.
    // TODO: Java core test failing on windows, https://github.com/apache/beam/issues/20464
    assumeFalse(SystemUtils.IS_OS_WINDOWS);
    assertEquals(
        toResourceIdentifier("/root/tmp/"),
        toResourceIdentifier("/root/tmp/").getCurrentDirectory());
    assertEquals(toResourceIdentifier("/"), toResourceIdentifier("/").getCurrentDirectory());

    // Tests path without parent.
    assertEquals(toResourceIdentifier("./"), toResourceIdentifier("output").getCurrentDirectory());
  }