Added: Path Selection (ComicInfo + Bundle Source), Bundle Checkbox

This commit is contained in:
Neshura 2023-11-15 23:59:09 +01:00
parent 87d703abe4
commit b5812fa32c
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
4 changed files with 108 additions and 7 deletions
src-tauri/src

View file

@ -2,6 +2,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use serde::{Deserialize, Serialize};
use std::path::MAIN_SEPARATOR_STR;
use crate::metadata::{*};
mod metadata;
@ -14,13 +15,20 @@ fn greet(name: &str) -> String {
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet, test])
.invoke_handler(tauri::generate_handler![greet, save])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[tauri::command]
fn test(message: metadata::Metadata) -> String {
message.save_to_xml("/home/neshura/Repositories/comicinfo-editor-v2/ComicInfo.xml");
format!("Series: '{}' | Title: '{}'", message.series_title, message.title)
fn save(metadata: Metadata, path: String) -> String {
let file_path: String;
if path.ends_with(MAIN_SEPARATOR_STR) {
file_path = path + "ComicInfo.xml";
}
else {
file_path = path + MAIN_SEPARATOR_STR + "ComicInfo.xml";
}
metadata.save_to_xml(&file_path);
file_path
}