add reader
parent
08b61c9779
commit
989aaf73a8
|
|
@ -12,6 +12,7 @@ fn main() {
|
|||
tauri::Builder::default()
|
||||
.setup(setup::init)
|
||||
.invoke_handler(tauri::generate_handler![test_command])
|
||||
.invoke_handler(tauri::generate_handler![read_resource_dir])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
|
@ -24,8 +25,10 @@ async fn test_command() -> String {
|
|||
|
||||
#[tauri::command]
|
||||
async fn read_resource_dir() -> String {
|
||||
let mut file_map = reader::FileMap::new();
|
||||
let file_map = reader::FileMap::new();
|
||||
let path = Path::new("./resource");
|
||||
fs::exists(path).is_err_and(|_|{fs::create_dir(path);return true;});
|
||||
if let Ok(false) = fs::exists(path){
|
||||
fs::create_dir(path).expect("Can't create dir");
|
||||
}
|
||||
serde_json::to_string(&file_map).unwrap()
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import ApplyBar from '@/components/ApplyBar.vue';
|
|||
import AddItem from '@/components/AddItem.vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { entry } from '@/ts/entry';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
interface Config {
|
||||
name: string,
|
||||
img: string
|
||||
|
|
@ -24,6 +25,7 @@ onMounted(() => {
|
|||
setTimeout(() => {
|
||||
entry("up", main, 20);
|
||||
})
|
||||
invoke("read_resource_dir", {}).then((res) => console.log(res));
|
||||
})
|
||||
|
||||
function openCard(config: Config) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue