| skipped 8 lines |
9 | 9 | | use itertools::Itertools; |
10 | 10 | | use prettytable::{format, row, Table}; |
11 | 11 | | use std::io::Write; |
| 12 | + | use std::path::Path; |
12 | 13 | | use std::{fs, io}; |
13 | 14 | | use unicode_segmentation::UnicodeSegmentation; |
14 | 15 | | |
15 | | - | fn format_path(path: &str, opts: &Params) -> Result<String> { |
16 | | - | let display_path = path.replace(opts.get_directory()?.to_string_lossy().as_ref(), ""); |
| 16 | + | fn format_path(path: &Path, opts: &Params) -> Result<String> { |
| 17 | + | let display_path = path |
| 18 | + | .to_string_lossy() |
| 19 | + | .replace(opts.get_directory()?.to_string_lossy().as_ref(), ""); |
17 | 20 | | let display_range = if display_path.chars().count() > 32 { |
18 | 21 | | display_path |
19 | 22 | | .graphemes(true) |
| skipped 14 lines |
34 | 37 | | Ok(format!("{:>12}", bytesize::ByteSize::b(file.size.unwrap()))) |
35 | 38 | | } |
36 | 39 | | |
37 | | - | fn modified_time(path: &String) -> Result<String> { |
| 40 | + | fn modified_time(path: &Path) -> Result<String> { |
38 | 41 | | let mdata = fs::metadata(path)?; |
39 | 42 | | let modified_time: DateTime<Utc> = mdata.modified()?.into(); |
40 | 43 | | |
| skipped 59 lines |
100 | 103 | | .clone() |
101 | 104 | | .enumerate() |
102 | 105 | | .for_each(|(index, file)| { |
103 | | - | println!("{}: {}", index.to_string().blue(), file.path); |
| 106 | + | println!("{}: {}", index.to_string().blue(), file.path.display()); |
104 | 107 | | }); |
105 | 108 | | |
106 | 109 | | match scan_group_confirmation().unwrap() { |
| skipped 78 lines |