static public FSEntry getPositionedFile ( String path , File file ) throws Exception { List < String > pathFrags = FSEntrySupport . interpretPath ( path ) ; // Start at leaf and work our way back int index = pathFrags . size ( ) - 1 ; FSEntry root = new FSEntryFile ( pathFrags . get ( index ) , file ) ; -- index ; while ( index >= 0 ) { FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory ( pathFrags . get ( index ) ) ; parent . addChildEntry ( root ) ; root = parent ; -- index ; } return root ; }
Create a virtual tree hierarchy with a file supporting the leaf .