summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/devices/system_device.rs7
-rw-r--r--src/metadata.rs19
2 files changed, 7 insertions, 19 deletions
diff --git a/src/devices/system_device.rs b/src/devices/system_device.rs
index bcffb86..383bb08 100644
--- a/src/devices/system_device.rs
+++ b/src/devices/system_device.rs
@@ -14,11 +14,8 @@ impl SystemDevice {
let pkg_version = env!("CARGO_PKG_VERSION");
let pkg_name = env!("CARGO_PKG_NAME");
let pkg_authors = env!("CARGO_PKG_AUTHORS");
- let name_str = format!("{pkg_name}, {pkg_version}");
- let mut authors_str = String::new();
- for author in pkg_authors.split(":") {
- authors_str.push_str(&format!("{author}, 2024\n"));
- }
+ let name_str = format!("{pkg_name}/{pkg_version}");
+ let authors_str = pkg_authors.replace(":", "\n");
Self {
name: ReadBuffer::from_str(&name_str),
authors: ReadBuffer::from_str(&authors_str),
diff --git a/src/metadata.rs b/src/metadata.rs
index 7130517..7692434 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -28,12 +28,9 @@ impl<'a> MetadataParser<'a> {
return None;
}
- let (name, version) = split_string(self.string(self.double(0x10)));
+ let (name, version) = split_name_version(self.string(self.double(0x10)));
let authors = self.string(self.double(0x12)).map(|string| {
- string.lines().map(|line| {
- let (name, year) = split_string(Some(line.to_string()));
- Author { name: name.unwrap(), year }
- }).collect()
+ string.lines().map(|line| line.to_string()).collect()
});
Some( ProgramMetadata {
@@ -89,9 +86,9 @@ impl<'a> MetadataParser<'a> {
}
}
-fn split_string(string: Option<String>) -> (Option<String>, Option<String>) {
+fn split_name_version(string: Option<String>) -> (Option<String>, Option<String>) {
if let Some(string) = string {
- match string.split_once(", ") {
+ match string.split_once('/') {
Some((left, right)) => (Some(left.to_string()), Some(right.to_string())),
None => (Some(string), None),
}
@@ -120,7 +117,7 @@ pub struct ProgramMetadata {
pub required_devices: u16,
pub name: Option<String>,
pub version: Option<String>,
- pub authors: Option<Vec<Author>>,
+ pub authors: Option<Vec<String>>,
pub description: Option<String>,
pub path_buffer: Option<usize>,
pub small_icon: Option<[u8; 72]>,
@@ -128,9 +125,3 @@ pub struct ProgramMetadata {
pub bg_colour: Option<Colour>,
pub fg_colour: Option<Colour>,
}
-
-
-pub struct Author {
- pub name: String,
- pub year: Option<String>,
-}