diff --git a/components/net/file_loader.rs b/components/net/file_loader.rs index e35f195a7a1..c85f23d2d14 100644 --- a/components/net/file_loader.rs +++ b/components/net/file_loader.rs @@ -8,6 +8,7 @@ use resource_task::ProgressMsg::{Payload, Done}; use std::borrow::ToOwned; use std::io; use std::fs::File; +use std::path::PathBuf; use std::sync::mpsc::Sender; use util::task::spawn_named; @@ -37,10 +38,10 @@ pub fn factory(load_data: LoadData, start_chan: Sender) { }; let progress_chan = start_sending(senders, Metadata::default(url.clone())); spawn_named("file_loader".to_owned(), move || { - let file_path: Result = url.to_file_path(); + let file_path: Result = url.to_file_path(); match file_path { Ok(file_path) => { - match File::open(&Path::new(file_path)) { + match File::open(&file_path) { Ok(ref mut reader) => { let res = read_all(reader, &progress_chan); progress_chan.send(Done(res)).unwrap(); diff --git a/components/net/lib.rs b/components/net/lib.rs index 4933d64f0e6..17219cdc06b 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -8,7 +8,6 @@ #![feature(core)] #![feature(int_uint)] #![feature(io)] -#![feature(old_path)] #![feature(path)] #![feature(path_ext)] #![feature(plugin)] diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index 27df208bd6d..c4b55c1836e 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -41,7 +41,7 @@ static mut HOST_TABLE: Option<*mut HashMap> = None; pub fn global_init() { //TODO: handle bad file path let path = match env::var("HOST_FILE") { - Ok(host_file_path) => Path::new(host_file_path), + Ok(host_file_path) => host_file_path, Err(_) => return, };