From ac6aa9b8b7a658eedfe03b7372adde51a703172a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 8 May 2015 18:00:25 -0400 Subject: [PATCH] when finding resource_dir, try exe launch directory external apps using servo may just have the resources/ in the same place --- components/util/resource_files.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/util/resource_files.rs b/components/util/resource_files.rs index 7c61a48f0ba..f9e89df4af1 100644 --- a/components/util/resource_files.rs +++ b/components/util/resource_files.rs @@ -25,14 +25,23 @@ pub fn resources_dir_path() -> PathBuf { // or `/components/servo/target/release`. let mut path = env::current_exe().ok().expect("can't get exe path"); path.pop(); - path.pop(); - path.pop(); - path.pop(); path.push("resources"); - if !path.is_dir() { // self_exe_path() is probably in .../target/release + if !path.is_dir() { // resources dir not in same dir as exe? + path.pop(); + 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"); + if !path.is_dir() { // self_exe_path() is probably in .../target/release + path.pop(); + path.pop(); + path.push("resources"); + } + } } path }