aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/resource_files.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/util/resource_files.rs')
-rw-r--r--components/util/resource_files.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/components/util/resource_files.rs b/components/util/resource_files.rs
index 58d6a17441c..d580b6f8a1e 100644
--- a/components/util/resource_files.rs
+++ b/components/util/resource_files.rs
@@ -39,20 +39,13 @@ pub fn resources_dir_path() -> PathBuf {
let mut path = env::current_exe().expect("can't get exe path");
// Follow symlink
path = path.canonicalize().expect("path does not exist");
- path.pop();
- path.push("resources");
- if !path.is_dir() { // resources dir not in same dir as exe?
- // exe is probably in target/{debug,release} so we need to go back to topdir
- path.pop();
- path.pop();
- path.pop();
+
+ while path.pop() {
path.push("resources");
- if !path.is_dir() {
- // exe is probably in target/$target_triple/{debug,release} so go back one more
- path.pop();
- path.pop();
- path.push("resources");
+ if path.is_dir() {
+ break;
}
+ path.pop();
}
*dir = Some(path.to_str().unwrap().to_owned());
path