String (String path) { if (Paths.equals(getPath(), getOldPath())) return path; String relative = Paths.relativeIfUnder(path, myPath); if (relative == null) return path; if (relative.isEmpty()) return getOldPath(); return Paths.appended(getOldPath(), relative); }