when finding resource_dir, try exe launch directory

external apps using servo may just have the resources/ in the same place
This commit is contained in:
Mike Blumenkrantz 2015-05-08 18:00:25 -04:00
parent 082479344f
commit ac6aa9b8b7

View file

@ -24,6 +24,9 @@ pub fn resources_dir_path() -> PathBuf {
// under `<servo source>/components/servo/target` // under `<servo source>/components/servo/target`
// or `<servo source>/components/servo/target/release`. // or `<servo source>/components/servo/target/release`.
let mut path = env::current_exe().ok().expect("can't get exe path"); let mut path = env::current_exe().ok().expect("can't get exe path");
path.pop();
path.push("resources");
if !path.is_dir() { // resources dir not in same dir as exe?
path.pop(); path.pop();
path.pop(); path.pop();
path.pop(); path.pop();
@ -33,6 +36,12 @@ pub fn resources_dir_path() -> PathBuf {
path.pop(); path.pop();
path.pop(); path.pop();
path.push("resources"); path.push("resources");
if !path.is_dir() { // self_exe_path() is probably in .../target/release
path.pop();
path.pop();
path.push("resources");
}
}
} }
path path
} }