Create CD desc

This commit is contained in:
jaby 2022-10-06 21:23:40 +02:00
parent 48626728e8
commit 5d0c1aae25
1 changed files with 5 additions and 3 deletions

View File

@ -47,8 +47,9 @@ pub struct DirectoryName {
}
impl DirectoryName {
pub fn from_str(str: &str) -> Result<DirectoryName, Error> {
Ok(DirectoryName{name: DString::from_str(str)?})
pub fn from_str(dir_name: &str) -> Result<DirectoryName, Error> {
let dir_name = dir_name.to_uppercase();
Ok(DirectoryName{name: DString::from_str(dir_name.as_ref())?})
}
}
@ -59,6 +60,7 @@ pub struct FileName {
impl FileName {
pub fn from_str(file_name: &str) -> Result<FileName, Error> {
let file_name = file_name.to_uppercase();
let (name, ext) = {
let mut sub_str = file_name.split('.');
(Error::ok_or_new(sub_str.next(), || "File name can't be emplty".to_owned())?, sub_str.next())
@ -82,4 +84,4 @@ impl Default for Properties {
fn default() -> Self {
Properties{lba: None, length: None}
}
}
}