30 lines
891 B
Rust
30 lines
891 B
Rust
#![cfg_attr(
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
windows_subsystem = "windows"
|
|
)]
|
|
|
|
#[cfg(target_os = "macos")]
|
|
mod menu;
|
|
|
|
use tauri::{utils::config::AppUrl, WindowUrl};
|
|
|
|
fn main() {
|
|
let port = 44548;
|
|
|
|
let mut context = tauri::generate_context!();
|
|
let url = format!("http://localhost:{}", port).parse().unwrap();
|
|
let window_url = WindowUrl::External(url);
|
|
// rewrite the config so the IPC is enabled on this URL
|
|
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
|
|
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
|
|
let builder = tauri::Builder::default();
|
|
|
|
#[cfg(target_os = "macos")]
|
|
let builder = builder.menu(menu::menu());
|
|
|
|
builder
|
|
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
|
.run(context)
|
|
.expect("error while building tauri application")
|
|
}
|