mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
servoshell: Read prefs.json from bundle on OHOS (#35581)
* Allows to read the prefs.json from the hap bundle on OHOS. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> * incorporate suggestions Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> * incoroporate requested changes Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
4f8d816385
commit
5fa014d389
2 changed files with 17 additions and 3 deletions
|
@ -6,6 +6,8 @@ use std::collections::HashMap;
|
|||
use std::fs::{read_to_string, File};
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
#[cfg(any(target_os = "android", target_env = "ohos"))]
|
||||
use std::sync::OnceLock;
|
||||
use std::{env, fs, process};
|
||||
|
||||
use euclid::Size2D;
|
||||
|
@ -90,9 +92,12 @@ pub fn default_config_dir() -> Option<PathBuf> {
|
|||
Some(config_dir)
|
||||
}
|
||||
|
||||
/// Overrides the default preference dir
|
||||
#[cfg(any(target_os = "android", target_env = "ohos"))]
|
||||
pub(crate) static DEFAULT_CONFIG_DIR: OnceLock<PathBuf> = OnceLock::new();
|
||||
#[cfg(any(target_os = "android", target_env = "ohos"))]
|
||||
pub fn default_config_dir() -> Option<PathBuf> {
|
||||
None
|
||||
DEFAULT_CONFIG_DIR.get().cloned()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue