Add data to cd desc

This commit is contained in:
jaby 2022-10-07 11:30:30 +02:00
parent 0756b26f75
commit d65b0bad61
2 changed files with 22 additions and 8 deletions

View File

@ -1,7 +1,17 @@
use psxcdgen_ex::types::CDDesc; use psxcdgen_ex::types::{CDDesc, Data};
use tool_helper::Error;
fn run_main() -> Result<(), Error> {
let mut desc = CDDesc::new();
let file = Data::new("Planschi")?;
desc.root.add_data(file);
Ok(())
}
fn main() { fn main() {
let _desc = CDDesc::new(); match run_main() {
Ok(_) => println!("Planschbecken"),
println!("Planschbecken"); Err(error) => println!("{}", error)
}
} }

View File

@ -14,10 +14,6 @@ impl CDDesc {
} }
} }
pub struct PVD {
}
pub struct Directory { pub struct Directory {
name: DirectoryName, name: DirectoryName,
properties: Properties, properties: Properties,
@ -29,6 +25,14 @@ impl Directory {
pub fn new(dir_name: &str) -> Result<Directory, Error> { pub fn new(dir_name: &str) -> Result<Directory, Error> {
Ok(Directory{name: DirectoryName::from_str(dir_name)?, properties: Properties::default(), data: Vec::new(), dirs: Vec::new()}) Ok(Directory{name: DirectoryName::from_str(dir_name)?, properties: Properties::default(), data: Vec::new(), dirs: Vec::new()})
} }
pub fn add_dir(&mut self, dir: Directory) {
self.dirs.push(dir);
}
pub fn add_data(&mut self, data: Data) {
self.data.push(data);
}
} }
pub struct Data { pub struct Data {