diff options
author | Narfinger <Narfinger@users.noreply.github.com> | 2025-03-01 11:53:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-01 10:53:35 +0000 |
commit | 5fa014d389f4d47c76f5a82e6c06b73338b1a4ff (patch) | |
tree | b9f595cbddbe907148b549f43cb41d3bdfadebe7 /ports/servoshell/egl/ohos/simpleservo.rs | |
parent | 4f8d816385a5837844a3986cda392bb6c0464fe6 (diff) | |
download | servo-5fa014d389f4d47c76f5a82e6c06b73338b1a4ff.tar.gz servo-5fa014d389f4d47c76f5a82e6c06b73338b1a4ff.zip |
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>
Diffstat (limited to 'ports/servoshell/egl/ohos/simpleservo.rs')
-rw-r--r-- | ports/servoshell/egl/ohos/simpleservo.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs index 5ba9ab9d6cf..77719eaa5f8 100644 --- a/ports/servoshell/egl/ohos/simpleservo.rs +++ b/ports/servoshell/egl/ohos/simpleservo.rs @@ -8,7 +8,7 @@ use std::ptr::NonNull; use std::rc::Rc; use dpi::PhysicalSize; -use log::{debug, info}; +use log::{debug, info, warn}; use raw_window_handle::{ DisplayHandle, OhosDisplayHandle, OhosNdkWindowHandle, RawDisplayHandle, RawWindowHandle, WindowHandle, @@ -40,7 +40,7 @@ pub fn init( info!("Entered simpleservo init function"); crate::init_crypto(); let resource_dir = PathBuf::from(&options.resource_dir).join("servo"); - resources::set(Box::new(ResourceReaderInstance::new(resource_dir))); + resources::set(Box::new(ResourceReaderInstance::new(resource_dir.clone()))); // It would be nice if `from_cmdline_args()` could accept str slices, to avoid allocations here. // Then again, this code could and maybe even should be disabled in production builds. @@ -53,6 +53,15 @@ pub fn init( ); debug!("Servo commandline args: {:?}", args); + let _ = crate::prefs::DEFAULT_CONFIG_DIR + .set(resource_dir) + .inspect_err(|e| { + warn!( + "Default Prefs Dir already previously filled. Got error {}", + e.display() + ); + }); + let (opts, preferences, servoshell_preferences) = match parse_command_line_arguments(args) { ArgumentParsingResult::ContentProcess(..) => { unreachable!("OHOS does not have support for multiprocess yet.") |