mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
auto merge of #5381 : Ms2ger/servo/old_path, r=jdm
This commit is contained in:
commit
fefdd9afba
6 changed files with 23 additions and 18 deletions
|
@ -38,7 +38,6 @@ use profile::time::{self, ProfilerCategory, profile};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||||
use std::old_path::Path;
|
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::num::Float;
|
use std::num::Float;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -1131,8 +1130,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if output_image {
|
if output_image {
|
||||||
let path: Path =
|
let path = opts::get().output_file.as_ref().unwrap();
|
||||||
opts::get().output_file.as_ref().unwrap().parse().unwrap();
|
|
||||||
let mut pixels = gl::read_pixels(0, 0,
|
let mut pixels = gl::read_pixels(0, 0,
|
||||||
width as gl::GLsizei,
|
width as gl::GLsizei,
|
||||||
height as gl::GLsizei,
|
height as gl::GLsizei,
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(old_io)]
|
#![feature(old_io)]
|
||||||
#![feature(old_path)]
|
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(std_misc)]
|
#![feature(std_misc)]
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use resource_task::ProgressMsg::{Payload, Done};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use util::task::spawn_named;
|
use util::task::spawn_named;
|
||||||
|
|
||||||
|
@ -37,10 +38,10 @@ pub fn factory(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
};
|
};
|
||||||
let progress_chan = start_sending(senders, Metadata::default(url.clone()));
|
let progress_chan = start_sending(senders, Metadata::default(url.clone()));
|
||||||
spawn_named("file_loader".to_owned(), move || {
|
spawn_named("file_loader".to_owned(), move || {
|
||||||
let file_path: Result<Path, ()> = url.to_file_path();
|
let file_path: Result<PathBuf, ()> = url.to_file_path();
|
||||||
match file_path {
|
match file_path {
|
||||||
Ok(file_path) => {
|
Ok(file_path) => {
|
||||||
match File::open(&Path::new(file_path)) {
|
match File::open(&file_path) {
|
||||||
Ok(ref mut reader) => {
|
Ok(ref mut reader) => {
|
||||||
let res = read_all(reader, &progress_chan);
|
let res = read_all(reader, &progress_chan);
|
||||||
progress_chan.send(Done(res)).unwrap();
|
progress_chan.send(Done(res)).unwrap();
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(io)]
|
#![feature(io)]
|
||||||
#![feature(old_path)]
|
|
||||||
#![feature(path)]
|
#![feature(path)]
|
||||||
#![feature(path_ext)]
|
#![feature(path_ext)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
|
|
|
@ -41,7 +41,7 @@ static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None;
|
||||||
pub fn global_init() {
|
pub fn global_init() {
|
||||||
//TODO: handle bad file path
|
//TODO: handle bad file path
|
||||||
let path = match env::var("HOST_FILE") {
|
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,
|
Err(_) => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,14 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(collections, core, env, io, os, path, rustc_private, std_misc, test)]
|
#![feature(collections)]
|
||||||
|
#![feature(core)]
|
||||||
|
#![feature(exit_status)]
|
||||||
|
#![feature(old_io)]
|
||||||
|
#![feature(path)]
|
||||||
|
#![feature(rustc_private)]
|
||||||
|
#![feature(std_misc)]
|
||||||
|
#![feature(test)]
|
||||||
|
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
@ -16,10 +23,10 @@ use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynT
|
||||||
use test::ShouldPanic;
|
use test::ShouldPanic;
|
||||||
use getopts::{getopts, reqopt};
|
use getopts::{getopts, reqopt};
|
||||||
use std::{str, env};
|
use std::{str, env};
|
||||||
use std::old_io::fs;
|
use std::ffi::OsStr;
|
||||||
|
use std::fs::read_dir;
|
||||||
use std::old_io::Reader;
|
use std::old_io::Reader;
|
||||||
use std::old_io::process::{Command, Ignored, CreatePipe, InheritFd, ExitStatus};
|
use std::old_io::process::{Command, Ignored, CreatePipe, InheritFd, ExitStatus};
|
||||||
use std::old_path::Path;
|
|
||||||
use std::thunk::Thunk;
|
use std::thunk::Thunk;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -67,13 +74,14 @@ fn test_options(config: Config) -> TestOpts {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_tests(config: Config) -> Vec<TestDescAndFn> {
|
fn find_tests(config: Config) -> Vec<TestDescAndFn> {
|
||||||
let files_res = fs::readdir(&Path::new(config.source_dir));
|
read_dir(&config.source_dir)
|
||||||
let mut files = match files_res {
|
.ok()
|
||||||
Ok(files) => files,
|
.expect("Error reading directory.")
|
||||||
_ => panic!("Error reading directory."),
|
.filter_map(Result::ok)
|
||||||
};
|
.map(|e| e.path())
|
||||||
files.retain(|file| file.extension_str() == Some("html") );
|
.filter(|file| file.extension().map_or(false, |e| e == OsStr::from_str("html")))
|
||||||
return files.iter().map(|file| make_test(file.display().to_string())).collect();
|
.map(|file| make_test(file.display().to_string()))
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_test(file: String) -> TestDescAndFn {
|
fn make_test(file: String) -> TestDescAndFn {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue