@Override
public Path find(final Path root, final String path) {
if(path.startsWith(String.valueOf(Path.DELIMITER))) {
final String normalized = this.normalize(path, true);
return new Path(normalized, normalized.equals(String.valueOf(Path.DELIMITER)) ?
EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory));
}
else {
if(path.startsWith(Path.HOME)) {
return new Path(String.format("%s%s%s", root.getAbsolute(), Path.DELIMITER, this.normalize(StringUtils.removeStart(
StringUtils.removeStart(path, Path.HOME), String.valueOf(Path.DELIMITER)), false)), EnumSet.of(Path.Type.directory));
}
else {
return new Path(String.format("%s%s%s", root.getAbsolute(), Path.DELIMITER, this.normalize(path, false)), EnumSet.of(Path.Type.directory));
}
}
}