Fixed json being snake_case and removed some unnescesary code

1.0.0-stable
Johannes Hendrik Gerard van der Weide 2024-10-01 21:09:09 +02:00
parent 3d1641a07d
commit 78904d4d08
1 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ struct Emoji {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct File { struct File {
downloaded: bool, downloaded: bool,
file_name: String, file_name: String,
@ -18,6 +19,7 @@ struct File {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct MetaJson { struct MetaJson {
meta_version: i32, meta_version: i32,
host: String, host: String,
@ -57,7 +59,7 @@ fn get_files() -> Vec<File> {
let name = file_name_parts[0]; let name = file_name_parts[0];
let extension = file_name_parts[1]; let extension = file_name_parts[1];
if file.as_ref().expect("Error: could not read file").path().with_extension(extension).exists() && extension == "png" { if extension == "png" || extension == "jpg" || extension == "jpeg" || extension == "gif" {
let file_name = file.expect("Error: could not read file").file_name().into_string().expect("Error: could not read filename as String"); let file_name = file.expect("Error: could not read file").file_name().into_string().expect("Error: could not read filename as String");
let emoji_data = Emoji { let emoji_data = Emoji {
name: name.to_string(), name: name.to_string(),