aboutsummaryrefslogtreecommitdiff
path: root/bundle/src-tauri/src
diff options
context:
space:
mode:
Diffstat (limited to 'bundle/src-tauri/src')
-rw-r--r--bundle/src-tauri/src/main.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/bundle/src-tauri/src/main.rs b/bundle/src-tauri/src/main.rs
new file mode 100644
index 0000000..34b1b70
--- /dev/null
+++ b/bundle/src-tauri/src/main.rs
@@ -0,0 +1,19 @@
+#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+
+#[tauri::command]
+fn read_file(path: String) -> Result<String, String> {
+ std::fs::read_to_string(path).map_err(|error| error.to_string())
+}
+
+#[tauri::command]
+fn write_file(path: String, text: String) -> Result<(), String> {
+ std::fs::write(path, text).map_err(|error| error.to_string())
+}
+
+fn main() {
+ tauri::Builder::default()
+ .plugin(tauri_plugin_dialog::init())
+ .invoke_handler(tauri::generate_handler![read_file, write_file])
+ .run(tauri::generate_context!())
+ .expect("Could not start CPSC Bundle");
+}