fix unix specific fs code
This commit is contained in:
parent
ccdaa1a966
commit
702a1dc024
1 changed files with 1 additions and 2 deletions
|
@ -3,7 +3,6 @@ use std::{
|
||||||
fs::{self, File},
|
fs::{self, File},
|
||||||
io::{BufReader, Read, Seek, Write},
|
io::{BufReader, Read, Seek, Write},
|
||||||
net::{TcpListener, TcpStream},
|
net::{TcpListener, TcpStream},
|
||||||
os::unix::fs::MetadataExt,
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
|
@ -131,7 +130,7 @@ fn get_file(request: Request) -> Option<(Content, bool)> {
|
||||||
} else if path.is_file() {
|
} else if path.is_file() {
|
||||||
let ext = path.extension().unwrap_or_default().to_str()?;
|
let ext = path.extension().unwrap_or_default().to_str()?;
|
||||||
let file = File::open(&path).ok()?;
|
let file = File::open(&path).ok()?;
|
||||||
let size = file.metadata().ok()?.size() as usize;
|
let size = file.metadata().ok()?.len() as usize;
|
||||||
|
|
||||||
let mut buf = vec![0; MAX_SIZE];
|
let mut buf = vec![0; MAX_SIZE];
|
||||||
let mut reader = BufReader::new(file);
|
let mut reader = BufReader::new(file);
|
||||||
|
|
Loading…
Reference in a new issue