mirror of https://github.com/bobwen-dev/hunter
show correct file size
This commit is contained in:
parent
89ffedad18
commit
1826fced28
11
src/files.rs
11
src/files.rs
|
@ -61,7 +61,7 @@ impl Files {
|
|||
let kind = get_kind(&file);
|
||||
let path = file.path();
|
||||
let meta = file.metadata().unwrap();
|
||||
let size = meta.len() / 1024;
|
||||
let size = meta.len();
|
||||
let mtime = meta.modified().unwrap();
|
||||
|
||||
let color = get_color(&path, &meta);
|
||||
|
@ -203,7 +203,7 @@ impl File {
|
|||
|
||||
let kind = Kind::Directory; //get_kind(&path);
|
||||
let meta = &path.metadata().unwrap();
|
||||
let size = meta.len() / 1024;
|
||||
let size = meta.len();
|
||||
let mtime = meta.modified().unwrap();
|
||||
let color = get_color(&path, meta);
|
||||
Ok(File::new(&name, pathbuf, kind, size as usize, mtime, color))
|
||||
|
@ -226,9 +226,10 @@ impl File {
|
|||
let unit = match unit {
|
||||
0 => "",
|
||||
1 => " KB",
|
||||
2 => " GB",
|
||||
3 => " TB",
|
||||
4 => "wtf are you doing",
|
||||
2 => " MB",
|
||||
3 => " GB",
|
||||
4 => " TB",
|
||||
5 => " wtf are you doing",
|
||||
_ => "",
|
||||
}
|
||||
.to_string();
|
||||
|
|
|
@ -47,7 +47,6 @@ impl Previewer {
|
|||
|
||||
//self.threads.install(|| {
|
||||
std::thread::spawn(move || {
|
||||
dbg!(&file);
|
||||
match &file.kind {
|
||||
Kind::Directory => match Files::new_from_path(&file.path) {
|
||||
Ok(files) => {
|
||||
|
|
|
@ -53,9 +53,10 @@ impl Widget for TextView {
|
|||
}
|
||||
fn refresh(&mut self) {
|
||||
let (xsize, ysize) = self.get_size().size();
|
||||
let (xpos, ypos) = self.get_position().position();
|
||||
let (xpos, ypos) = self.get_coordinates().position().position();
|
||||
|
||||
self.buffer = self
|
||||
self.buffer = self.get_clearlist() +
|
||||
&self
|
||||
.lines
|
||||
.par_iter()
|
||||
.take(ysize as usize)
|
||||
|
@ -69,7 +70,7 @@ impl Widget for TextView {
|
|||
xsize = xsize as usize
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
.collect::<String>();
|
||||
}
|
||||
|
||||
fn get_drawlist(&self) -> String {
|
||||
|
|
Loading…
Reference in New Issue