diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2015-01-05 13:25:13 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-01-09 07:04:44 +1000 |
commit | cf047d6cef0e2c13d746c4210e7fa41301bc82f7 (patch) | |
tree | f09b99554ccddbd52cf9e6fc9b2866529e01f785 /components/util/resource_files.rs | |
parent | 7800d98728bfa1375ad8b6a2dac7f2f35603b6d1 (diff) | |
download | servo-cf047d6cef0e2c13d746c4210e7fa41301bc82f7.tar.gz servo-cf047d6cef0e2c13d746c4210e7fa41301bc82f7.zip |
Add ability to explicitly set static resources path, used by cef-linux.
Diffstat (limited to 'components/util/resource_files.rs')
-rw-r--r-- | components/util/resource_files.rs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/components/util/resource_files.rs b/components/util/resource_files.rs index b40c93f2651..9dd0e199ad3 100644 --- a/components/util/resource_files.rs +++ b/components/util/resource_files.rs @@ -4,6 +4,7 @@ use std::io::{File, IoResult}; use std::path::Path; +use opts; #[cfg(not(target_os = "android"))] use std::io::fs::PathExtensions; @@ -17,20 +18,25 @@ pub fn resources_dir_path() -> Path { #[cfg(not(target_os = "android"))] pub fn resources_dir_path() -> Path { - // FIXME: Find a way to not rely on the executable being - // under `<servo source>/components/servo/target` - // or `<servo source>/components/servo/target/release`. - let mut path = os::self_exe_path().expect("can't get exe path"); - path.pop(); - path.pop(); - path.pop(); - path.push("resources"); - if !path.is_dir() { // self_exe_path() is probably in .../target/release - path.pop(); - path.pop(); - path.push("resources"); + match opts::get().resources_path { + Some(ref path) => Path::new(path), + None => { + // FIXME: Find a way to not rely on the executable being + // under `<servo source>/components/servo/target` + // or `<servo source>/components/servo/target/release`. + let mut path = os::self_exe_path().expect("can't get exe path"); + path.pop(); + path.pop(); + path.pop(); + path.push("resources"); + if !path.is_dir() { // self_exe_path() is probably in .../target/release + path.pop(); + path.pop(); + path.push("resources"); + } + path + } } - path } |