mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 21:20:17 +00:00
move some code to utils and move around functions
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
use crate::utils;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uefi::cstr16;
|
||||
use uefi::fs::{FileSystem, Path};
|
||||
use uefi::proto::media::fs::SimpleFileSystem;
|
||||
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
pub struct RootConfiguration {
|
||||
@@ -21,13 +19,6 @@ pub struct ChainloaderConfiguration {
|
||||
}
|
||||
|
||||
pub fn load() -> RootConfiguration {
|
||||
let fs = uefi::boot::open_protocol_exclusive::<SimpleFileSystem>(
|
||||
uefi::boot::get_handle_for_protocol::<SimpleFileSystem>().expect("no filesystem protocol"),
|
||||
)
|
||||
.expect("unable to open filesystem protocol");
|
||||
let mut fs = FileSystem::new(fs);
|
||||
let content = fs
|
||||
.read(Path::new(cstr16!("sprout.toml")))
|
||||
.expect("unable to read sprout.toml file");
|
||||
let content = utils::read_file_contents("sprout.toml");
|
||||
toml::from_slice(&content).expect("unable to parse sprout.toml file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user