mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-03 03:27:03 +00:00
feat(io): add read_file/write_file commands and dialog capability
This commit is contained in:
1 parent
eb63a6d49d
commit
13f2a70af2
3 files changed
+20
-2
No files matched your search
@@ -0,0 +1,11 @@
|
||||
use std::fs;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn read_file(path: String) -> Result<String, String> {
|
||||
fs::read_to_string(&path).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn write_file(path: String, contents: String) -> Result<(), String> {
|
||||
fs::write(&path, contents).map_err(|e| e.to_string())
|
||||
}
|
||||
Reference in new issue
Block a user