diff --git a/components/util/lib.rs b/components/util/lib.rs index 61c6de2475c..45085733f3b 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -8,7 +8,7 @@ #![feature(core)] #![feature(exit_status)] #![feature(optin_builtin_traits)] -#![cfg_attr(not(target_os = "android"), feature(path_ext))] +#![feature(path_ext)] #![feature(plugin)] #![feature(rustc_private)] #![feature(step_by)] diff --git a/components/util/opts.rs b/components/util/opts.rs index 598d27fbd0b..19b5afa9a82 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -16,7 +16,9 @@ use std::collections::HashSet; use std::cmp; use std::env; use std::io::{self, Write}; +use std::fs::PathExt; use std::mem; +use std::path::Path; use std::ptr; use url::{self, Url}; @@ -310,8 +312,14 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let cwd = env::current_dir().unwrap(); match Url::parse(url) { Ok(url) => url, - Err(url::ParseError::RelativeUrlWithoutBase) - => Url::from_file_path(&*cwd.join(url)).unwrap(), + Err(url::ParseError::RelativeUrlWithoutBase) => { + if Path::new(url).exists() { + Url::from_file_path(&*cwd.join(url)).unwrap() + } else { + args_fail(&format!("File not found: {}", url)); + return false; + } + } Err(_) => panic!("URL parsing failed"), } };