Compare commits

...

2 commits

Author SHA1 Message Date
SuchAFuriousDeath 88129472f5
Merge branch 'main' into hv-mac 2024-05-06 21:24:10 +02:00
VocalFan 4512e9cc24
Fix the UI version stuff (#862) 2024-05-06 23:58:27 +07:00
2 changed files with 8 additions and 8 deletions

View file

@ -65,5 +65,8 @@ pub unsafe extern "C" fn param_title_id_get(param: &Param, buf: &mut QString) {
#[no_mangle]
pub unsafe extern "C" fn param_version_get(param: &Param, buf: &mut QString) {
buf.set(param.version());
match param.version() {
Some(version) => buf.set(version),
None => buf.set(""),
}
}

View file

@ -12,7 +12,7 @@ pub struct Param {
content_id: Box<str>,
title: Option<Box<str>>,
title_id: Box<str>,
version: Box<str>,
version: Option<Box<str>>,
}
impl Param {
@ -166,7 +166,7 @@ impl Param {
content_id: content_id.ok_or(ReadError::MissingContentId)?,
title,
title_id: title_id.ok_or(ReadError::MissingTitleId)?,
version: version.ok_or(ReadError::MissingVersion)?,
version: version,
})
}
@ -204,8 +204,8 @@ impl Param {
}
/// Fetches the value VERSION from given Param.SFO
pub fn version(&self) -> &str {
&self.version
pub fn version(&self) -> Option<&str> {
self.version.as_deref()
}
fn read_utf8<R: Read>(
@ -276,7 +276,4 @@ pub enum ReadError {
#[error("TITLE_ID parameter not found")]
MissingTitleId,
#[error("VERSION parameter not found")]
MissingVersion,
}