-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6775e9
commit a296ce5
Showing
8 changed files
with
151 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
use std::path::PathBuf; | ||
use std::sync::Mutex; | ||
use notify::RecommendedWatcher; | ||
use serde::{Deserialize, Serialize}; | ||
const AUTO_SAVE_VERSION: u32 = 1; | ||
#[derive(Serialize, Deserialize)] | ||
pub struct AutoSaveDetails { | ||
version: u32, | ||
files: Vec<PathBuf> | ||
} | ||
pub struct AutoSaveState { | ||
details: AutoSaveDetails, | ||
watcher: Option<RecommendedWatcher> | ||
} | ||
impl AutoSaveState { | ||
pub fn new(app: tauri::AppHandle) -> AutoSaveState { | ||
let watcher = notify::recommended_watcher(|event| { | ||
let Ok(event) = event else { return }; | ||
}).ok(); | ||
AutoSaveState { | ||
details: AutoSaveDetails { | ||
version: AUTO_SAVE_VERSION, | ||
files: vec![], | ||
}, | ||
watcher | ||
} | ||
} | ||
pub fn read_from_disc(app: tauri::AppHandle) -> AutoSaveState { | ||
let path = tauri::api::path::app_data_dir(&app.config()); | ||
Self::new(app) | ||
} | ||
} | ||
#[derive(Serialize)] | ||
pub struct AutoSaveFile { | ||
path: String, | ||
name: String | ||
} | ||
#[tauri::command] | ||
pub fn register_files(files: Vec<String>, state: tauri::State<Mutex<AutoSaveState>>, app_handle: tauri::AppHandle) { | ||
let mut pointer = state.lock().unwrap(); | ||
} | ||
#[tauri::command] | ||
pub fn get_files(state: tauri::State<Mutex<AutoSaveState>>) -> Vec<AutoSaveFile> { | ||
let mut pointer = state.lock().unwrap(); | ||
vec![] | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters