Remove dirs crate from use in UWP builds.

This commit is contained in:
Josh Matthews 2019-06-11 09:02:40 -04:00
parent 237ef8da34
commit 3e22b52b47
7 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,9 @@ license = "MPL-2.0"
edition = "2018"
publish = false
[features]
uwp = []
[lib]
name = "servo_config"
path = "lib.rs"
@ -29,5 +32,5 @@ servo_config_plugins = { path = "../config_plugins" }
env_logger = "0.6"
std_test_override = { path = "../std_test_override" }
[target.'cfg(not(target_os = "android"))'.dependencies]
[target.'cfg(not(any(target_os = "android", feature = "uwp")))'.dependencies]
dirs = "1.0"

View file

@ -35,9 +35,14 @@ pub fn default_config_dir() -> Option<PathBuf> {
Some(config_dir)
}
#[cfg(target_os = "windows")]
#[cfg(all(target_os = "windows", not(feature = "uwp")))]
pub fn default_config_dir() -> Option<PathBuf> {
let mut config_dir = ::dirs::config_dir().unwrap();
config_dir.push("Servo");
Some(config_dir)
}
#[cfg(all(target_os = "windows", feature = "uwp"))]
pub fn default_config_dir() -> Option<PathBuf> {
None
}

View file

@ -58,7 +58,7 @@ pub fn pref_map() -> &'static Preferences<'static, Prefs> {
&PREFS
}
pub fn add_user_prefs() {
pub(crate) fn add_user_prefs() {
if let Some(path) = user_prefs_path() {
init_user_prefs(path);
}

View file

@ -244,7 +244,7 @@ fn test_set_all_error_on_unknown_field() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[cfg(not(target_os = "android"))]
#[cfg(not(any(target_os = "android", feature = "uwp")))]
#[test]
fn test_default_config_dir_create_read_write() {
let json_str = "{\

View file

@ -21,6 +21,7 @@ js_backtrace = ["script/js_backtrace"]
max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["bluetooth/native-bluetooth"]
raqote_backend = ["canvas/raqote_backend"]
uwp = ["servo_config/uwp"]
webrender_debugger = ["webrender/debugger"]
no_static_freetype = ["webrender/no_static_freetype"]
oculusvr = ["webvr/oculusvr"]

View file

@ -40,4 +40,5 @@ oculusvr = ["libservo/oculusvr"]
raqote_backend = ["libservo/raqote_backend"]
webdriver = ["libservo/webdriver"]
unstable = ["libservo/unstable"]
uwp = ["libservo/uwp"]
webgl_backtrace = ["libservo/webgl_backtrace"]

View file

@ -33,5 +33,6 @@ native-bluetooth = ["simpleservo/native-bluetooth"]
oculusvr = ["simpleservo/oculusvr"]
raqote_backend = ["simpleservo/raqote_backend"]
unstable = ["simpleservo/unstable"]
uwp = ["simpleservo/uwp"]
webdriver = ["simpleservo/webdriver"]
webgl_backtrace = ["simpleservo/webgl_backtrace"]