diff --git a/components/config/Cargo.toml b/components/config/Cargo.toml index 885eee5f5d6..4698bfe9a35 100644 --- a/components/config/Cargo.toml +++ b/components/config/Cargo.toml @@ -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" diff --git a/components/config/basedir.rs b/components/config/basedir.rs index a7e5226dea9..af993e3852f 100644 --- a/components/config/basedir.rs +++ b/components/config/basedir.rs @@ -35,9 +35,14 @@ pub fn default_config_dir() -> Option { Some(config_dir) } -#[cfg(target_os = "windows")] +#[cfg(all(target_os = "windows", not(feature = "uwp")))] pub fn default_config_dir() -> Option { 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 { + None +} diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 924577b2a39..0c6e394ffaa 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -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); } diff --git a/components/config/tests/prefs.rs b/components/config/tests/prefs.rs index 16812b40ac3..bcaa5f5bb0e 100644 --- a/components/config/tests/prefs.rs +++ b/components/config/tests/prefs.rs @@ -244,7 +244,7 @@ fn test_set_all_error_on_unknown_field() -> Result<(), Box> { 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 = "{\ diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 903fc0f9c5a..2fe44ec362f 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -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"] diff --git a/ports/libsimpleservo/api/Cargo.toml b/ports/libsimpleservo/api/Cargo.toml index 7c48fa4de21..11e6d4ac210 100644 --- a/ports/libsimpleservo/api/Cargo.toml +++ b/ports/libsimpleservo/api/Cargo.toml @@ -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"] diff --git a/ports/libsimpleservo/capi/Cargo.toml b/ports/libsimpleservo/capi/Cargo.toml index 7764f3fe71b..89585fdb1a8 100644 --- a/ports/libsimpleservo/capi/Cargo.toml +++ b/ports/libsimpleservo/capi/Cargo.toml @@ -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"]