private Path assembleRelativeSegments ( final Path path , final Path base , final Deque < String > segments ) { if ( segments . isEmpty ( ) && path . isDirectory ( ) && base . isFile ( ) ) { segments . add ( CURRENT ) ; } return Path . create ( assembleSegments ( segments , path . getFile ( ) ) ) ; }
If there are no segments in the resolved path and we are trying to resolve a directory coming from a path we have to make explicit that we want the directory