List<Path> (@NotNull Path file) { List<Path> result = new ArrayList<>(); result.add(file); Path home = file.getFileName(); if (home != null && home.toString().equalsIgnoreCase("Home")) { Path parentFile = file.getParent(); if (parentFile != null) { result.add(parentFile); Path contents = parentFile.getFileName(); if (contents != null && contents.toString().equalsIgnoreCase("Contents")) { Path parentParentFile = parentFile.getParent(); if (parentParentFile != null) { result.add(parentParentFile); } } } } return result; }