Added: Path Selection (ComicInfo + Bundle Source), Bundle Checkbox
This commit is contained in:
parent
87d703abe4
commit
b5812fa32c
4 changed files with 108 additions and 7 deletions
src-tauri/src
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue