Skip to content

Commit

Permalink
tauri config fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frnsys committed Aug 10, 2024
1 parent 2656ecb commit e81cb39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
24 changes: 0 additions & 24 deletions hes-editor/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@
windows_subsystem = "windows"
)]

use std::{fs, io::prelude::*, path::PathBuf};

#[tauri::command]
async fn read_file(path: PathBuf) -> Result<String, String> {
match fs::read_to_string(path) {
Ok(contents) => Ok(contents),
Err(err) => Err(err.to_string()),
}
}

#[tauri::command]
async fn write_file(
path: PathBuf,
content: String,
) -> Result<(), String> {
match fs::write(path, content) {
Ok(_) => Ok(()),
Err(err) => Err(err.to_string()),
}
}

fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![
read_file, write_file,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
12 changes: 4 additions & 8 deletions hes-game/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#![cfg_attr(
not(debug_assertions),
windows_subsystem = "windows"
)]

fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
8 changes: 4 additions & 4 deletions hes-game/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"build": {
"beforeDevCommand": "cargo leptos watch",
"beforeBuildCommand": "cargo leptos build --release",
"devPath": "http://localhost:3000",
"distDir": "../target/site/pkg",
"beforeDevCommand": "trunk serve",
"beforeBuildCommand": "trunk build --release",
"devPath": "http://localhost:1420",
"distDir": "../dist",
"withGlobalTauri": true
},
"package": {
Expand Down

0 comments on commit e81cb39

Please sign in to comment.