@@ -283,16 +283,33 @@ pub fn show_file_name(e: &&std::path::PathBuf, wide_mode: bool) -> Result<(), Bo
283283 print ! ( "{}" , color:: Fg ( color:: LightMagenta ) ) ;
284284 }
285285 print ! ( "{} -> " , Style :: new( ) . bold( ) . paint( e. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) ) ) ;
286- if fs:: read_link ( e) ?. is_dir ( ) {
287- if !colors_on {
288- print ! ( "{}" , color:: Fg ( color:: LightBlue ) ) ;
286+ match fs:: canonicalize ( fs:: read_link ( e) ?) {
287+ Ok ( _n) => {
288+ if fs:: read_link ( e) ?. is_dir ( ) {
289+ if !colors_on {
290+ print ! ( "{}" , color:: Fg ( color:: LightBlue ) ) ;
291+ print ! ( "{}/" , fs:: canonicalize( fs:: read_link( e) ?) . unwrap( ) . to_str( ) . unwrap( ) )
292+ }
293+ } else {
294+ if !colors_on {
295+ print ! ( "{}" , color:: Fg ( color:: LightGreen ) ) ;
296+ print ! ( "{}" , fs:: canonicalize( fs:: read_link( e) ?) . unwrap( ) . to_str( ) . unwrap( ) )
297+ }
298+ }
299+ } ,
300+ Err ( _err) => {
301+ if fs:: read_link ( e) ?. is_dir ( ) {
302+ if !colors_on {
303+ print ! ( "{}" , color:: Fg ( color:: LightBlue ) ) ;
304+ print ! ( "{}/" , fs:: read_link( e) ?. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) )
305+ }
306+ } else {
307+ if !colors_on {
308+ print ! ( "{}" , color:: Fg ( color:: LightGreen ) ) ;
309+ print ! ( "{}" , fs:: read_link( e) ?. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) )
310+ }
311+ }
289312 }
290- print ! ( "{}/" , fs:: read_link( e) ?. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) ) ;
291- } else {
292- if !colors_on {
293- print ! ( "{}" , color:: Fg ( color:: LightGreen ) ) ;
294- }
295- print ! ( "{}" , fs:: read_link( e) ?. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) ) ;
296313 }
297314 if !wide_mode {
298315 print ! ( "\n " ) ;
0 commit comments