@@ -83,14 +83,11 @@ impl App {
8383 }
8484
8585 pub fn get_current_string_path ( & self ) -> String {
86- let mut all_names = self
86+ let all_names = self
8787 . parent_nodes
8888 . iter ( )
8989 . map ( |node| node. name . to_string ( ) )
9090 . collect :: < Vec < String > > ( ) ;
91- if !self . starting_dir . is_empty ( ) {
92- all_names. insert ( 0 , self . starting_dir . clone ( ) ) ;
93- }
9491 if all_names. is_empty ( ) {
9592 return "/" . to_string ( ) ;
9693 }
@@ -103,8 +100,9 @@ impl App {
103100
104101 let nodes_result = list_files ( std:: path:: Path :: new ( & path) ) ;
105102 if nodes_result. is_err ( ) {
106- self . error_message = Some ( nodes_result. unwrap_err ( ) . to_string ( ) ) ;
103+ self . error_message = Some ( contextualized_error ( & nodes_result. unwrap_err ( ) ) ) ;
107104 self . child_nodes = vec ! [ ] ;
105+ self . render_tree_nodes ( ) ;
108106 return ;
109107 }
110108 let mut nodes = nodes_result. unwrap ( ) ;
@@ -185,16 +183,12 @@ impl App {
185183 }
186184 let selected_node: FileNode = selected_node_o. unwrap ( ) ;
187185
188- let mut all_names = self
189- . parent_nodes
190- . iter ( )
191- . map ( |node| node. name . to_string ( ) )
192- . collect :: < Vec < String > > ( ) ;
193- if !self . starting_dir . is_empty ( ) {
194- all_names. insert ( 0 , self . starting_dir . clone ( ) ) ;
195- }
196- all_names. push ( selected_node. name . to_string ( ) ) ;
197- let selected_path = normalize_path ( all_names. join ( "/" ) ) ;
186+ let current_path = self . get_current_string_path ( ) ;
187+ let selected_path = normalize_path ( format ! (
188+ "{}/{}" ,
189+ current_path,
190+ selected_node. name. to_string( )
191+ ) ) ;
198192
199193 self . picked_path = Some ( selected_path) ;
200194 self . quit ( ) ;
0 commit comments