#Problem with window creation

1 messages · Page 1 of 1 (latest)

mortal pond
#

Inside that command, I take the users directory, create a config and save it, close the welcome window and spawn main.

#[tauri::command]
fn save_notes_dir(handle: AppHandle, notes_dir: PathBuf) {
    if let Some(welcome) = handle.get_window("welcome") {
        if let Ok(_) = welcome.close() {
            let config = Config::new(notes_dir);
            
            if let Ok(_) = config.store_config(&handle.path_resolver()) {
                if let Ok(_) = welcome.close() {
                    spawn_main(handle, config.notes_dir, 1920.0, 1080.0);
                }
            }
        }
    }
}

Now, when the program goes this route, it gets here, closes the welcome window and then when its supposed to create the main window, it calls the function, inside that function it spawns the thread, but no window appears and the program stops, Why?

mortal pond
#

Also I can't understand when I create the main Window, there is a data_directory(path) method. When I set it to some path, how do I access that path inside the window frontend? I thought it would be the dataDir function from api/path but that returns different path, than I pass into the data_directory function. In documentation it just says "Data directory for the webview." and I got completelly lost in the codebase and all these WebViewAttributes and PendingWindows and at this point I spent on this whole weekend and I am this close to losing it.

mortal pond
#

window.close() doesnt let other windows be created