@Override
    public Path findPathInWorkdirOrLookup(Path uri) {

        Optional<Path> lookUpFile = pathMapper.lookUpFile(uri);

        if (lookUpFile.isPresent()) {
            return lookUpFile.get();
        }

        Optional<Path> optional = current.currentPath().map(Path::getParent);

        if (optional.isPresent()) {
            Path resolve = optional.get().resolve(uri);

            if (Files.exists(resolve)) {
                return resolve;
            }
        }

        Path workingDirectory = workingDirectory();
        Path resolve = workingDirectory.resolve(uri);

        if (Files.exists(resolve)) {
            return resolve;
        }

        if (optional.isPresent()) {
            Path currentParent = optional.get();

            while (true) {

                if (Objects.nonNull(currentParent)) {
                    Path candidate = currentParent.resolve(uri);
                    if (Files.exists(candidate)) {
                        return candidate;
                    } else {
                        currentParent = currentParent.getParent();
                    }
                } else {
                    break;
                }

            }

        }

        return null;

    }
Resolve a file to a valid base browsing directory
@param referenceFile The base directory or a child file that should be used as a browsing base path
@return A valid directory's File object
src/main/java/com/kodedu/service/impl/DirectoryServiceImpl.java