mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add ability to explicitly set static resources path, used by cef-linux.
This commit is contained in:
parent
7800d98728
commit
cf047d6cef
3 changed files with 36 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue