LocalResourceId implements ResourceId { @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("."); } checkState(parent != null, "Failed to get the current directory for path: [%s].", pathString); return fromPath(parent, true ); } } private  LocalResourceId(Path path, boolean isDirectory); @Override LocalResourceId resolve(String other, ResolveOptions resolveOptions); @Override LocalResourceId getCurrentDirectory(); @Override @Nullable String getFilename(); @Override String getScheme(); @Override boolean isDirectory(); @Override String toString(); @Override boolean equals(@Nullable Object obj); @Override int hashCode();  }
@Test public void testGetCurrentDirectoryInUnix() { assumeFalse(SystemUtils.IS_OS_WINDOWS); assertEquals( toResourceIdentifier("/root/tmp/"), toResourceIdentifier("/root/tmp/").getCurrentDirectory()); assertEquals(toResourceIdentifier("/"), toResourceIdentifier("/").getCurrentDirectory()); assertEquals(toResourceIdentifier("./"), toResourceIdentifier("output").getCurrentDirectory()); }