Break the build again.

This commit is contained in:
Bas Wiel, van de 2024-04-29 22:14:02 +02:00
parent d08d32352b
commit 29bab3f338
1 changed files with 23 additions and 3 deletions

View File

@ -5,16 +5,36 @@ use crate::{
partition::{Partition, PartitionType},
Disk,
},
downloader::ZipDownloader,
fat::{direntry::DirEntryType, vbr::Vbr, Fat},
downloader::{file::DownloadedFile, ZipDownloader},
fat::{direntry::{DirEntry, DirEntryType}, vbr::Vbr, Fat},
manifest::Manifest,
os::OperatingSystem,
};
#[derive(Debug)]
pub struct DiskBuilder;
pub struct DiskBuilder {
filesystem: Fat,
operating_system: OperatingSystem,
disk: Disk,
}
impl DiskBuilder {
/// Create a new filesystem
pub fn new(manifest: &Manifest) -> Result<Self, std::io::Error> {
let mut disk = Disk::new(manifest.disktype.as_str(), manifest.os.as_str())?;
disk.attach(manifest.diskname.as_str())?;
disk.set_geometry(manifest.disksize)?;
Ok(DiskBuilder {
disk,
filesystem: Fat::new(&disk, partition, os)?,
})
}
/// Copy a file from ZIP to VHD
pub fn copy_file(file: &DownloadedFile, directory: Option<&mut DirEntry>, partition: &Partition, disk: &mut Disk) {
let allocated_clusters =
let new_file = DirEntry::new(file.get_name(), DirEntryType::File, None, allocated_clusters, file_size, data)
}
/// The builder is the struct that does all manner of validation before trying to
/// create a Disk so that what we create will make sense.
pub fn build(manifest: &Manifest) -> Result<(), std::io::Error> {