#read file outside main

2 messages · Page 1 of 1 (latest)

spice granite
#

hey got some file i want to read to make it an instance

//src-tauri/src/models/rune.rs
        let json_file_path = "assets/runes.json"; 
        let json_string = fs::read_to_string(json_file_path)
            .expect("Failed to read JSON file");
        let runes: HashMap<String, Rune> = serde_json::from_str(&json_string)
            .expect("Failed to deserialize JSON");

got this in tauri.conf

    "bundle": {
      "resources": [
        "assets/runes.json"
      ],

but when i run it in release i tell me find not found
it look like it can't resolve assets
i've seen some example using path resolve but since i'm outside of main i don't know how to call it

#

note that i can't inject apphandler via command function since it's an auto process and it would be awfull to pass the handler from the command nested deep inside this init