@Override
    public void changeWorkigDir(Path path) {
        if (Objects.isNull(path))
            return;

        if (!Files.exists(path)) {
            Path closestParentOrWorkdir = findClosestParentOrWorkdir(path);
            logger.error("Path: {} is no longer exist. Workdir set to: {}", path, closestParentOrWorkdir);
            path = closestParentOrWorkdir;
        }

        pathMapper.addRootPath(path);
        storedConfigBean.setWorkingDirectory(path.toString());
        this.setWorkingDirectory(Optional.of(path));
        this.setInitialDirectory(Optional.ofNullable(path.toFile()));

        eventService.sendEvent(DirectoryService.WORKING_DIRECTORY_UPDATE_EVENT, path);
    }
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