core: Made NullNavigatorBackend no longer use unwraps

This commit is contained in:
Nathan Adams 2022-12-30 23:24:11 +01:00
parent 84d0111a14
commit 7a9e8b4771
3 changed files with 6 additions and 6 deletions

View File

@ -249,11 +249,11 @@ impl NullNavigatorBackend {
} }
} }
pub fn with_base_path(path: &Path, executor: &NullExecutor) -> Self { pub fn with_base_path(path: &Path, executor: &NullExecutor) -> Result<Self, std::io::Error> {
Self { Ok(Self {
spawner: executor.spawner(), spawner: executor.spawner(),
relative_base_path: path.canonicalize().unwrap(), relative_base_path: path.canonicalize()?,
} })
} }
#[cfg(any(unix, windows, target_os = "redox"))] #[cfg(any(unix, windows, target_os = "redox"))]

View File

@ -21,7 +21,7 @@ fn execute_swf(file: &Path) {
let frame_time = 1000.0 / movie.frame_rate().to_f64(); let frame_time = 1000.0 / movie.frame_rate().to_f64();
let player = PlayerBuilder::new() let player = PlayerBuilder::new()
.with_log(ScanLogBackend::new()) .with_log(ScanLogBackend::new())
.with_navigator(NullNavigatorBackend::with_base_path(base_path, &executor)) .with_navigator(NullNavigatorBackend::with_base_path(base_path, &executor).unwrap())
.with_max_execution_duration(Duration::from_secs(300)) .with_max_execution_duration(Duration::from_secs(300))
.with_movie(movie) .with_movie(movie)
.build(); .build();

View File

@ -1444,7 +1444,7 @@ fn run_swf(
let player = builder let player = builder
.with_log(TestLogBackend::new(trace_output.clone())) .with_log(TestLogBackend::new(trace_output.clone()))
.with_navigator(NullNavigatorBackend::with_base_path(base_path, &executor)) .with_navigator(NullNavigatorBackend::with_base_path(base_path, &executor)?)
.with_max_execution_duration(Duration::from_secs(300)) .with_max_execution_duration(Duration::from_secs(300))
.with_viewport_dimensions( .with_viewport_dimensions(
movie.width().to_pixels() as u32, movie.width().to_pixels() as u32,