mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add a pref for a default homepage.
This commit is contained in:
parent
79e548905e
commit
8d9ab50a96
5 changed files with 46 additions and 15 deletions
|
@ -5,6 +5,18 @@
|
|||
use std::fs::File;
|
||||
use std::io::{self, Read};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
lazy_static! {
|
||||
static ref CMD_RESOURCE_DIR: Arc<Mutex<Option<String>>> = {
|
||||
Arc::new(Mutex::new(None))
|
||||
};
|
||||
}
|
||||
|
||||
pub fn set_resources_path(path: Option<String>) {
|
||||
let mut dir = CMD_RESOURCE_DIR.lock().unwrap();
|
||||
*dir = path;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn resources_dir_path() -> PathBuf {
|
||||
|
@ -13,11 +25,10 @@ pub fn resources_dir_path() -> PathBuf {
|
|||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
pub fn resources_dir_path() -> PathBuf {
|
||||
use opts;
|
||||
use std::env;
|
||||
use std::fs::PathExt;
|
||||
|
||||
match opts::get().resources_path {
|
||||
match *CMD_RESOURCE_DIR.lock().unwrap() {
|
||||
Some(ref path) => PathBuf::from(path),
|
||||
None => {
|
||||
// FIXME: Find a way to not rely on the executable being
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue