mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
chore(deps): update to tauri alpha.8 (#303)
This commit is contained in:
committed by
GitHub
parent
14e4705d55
commit
bbdccefa2d
@@ -327,7 +327,7 @@ impl Builder {
|
||||
LogTarget::LogDir => continue,
|
||||
#[cfg(desktop)]
|
||||
LogTarget::LogDir => {
|
||||
let path = app_handle.path_resolver().app_log_dir().unwrap();
|
||||
let path = app_handle.path().app_log_dir().unwrap();
|
||||
if !path.exists() {
|
||||
fs::create_dir_all(&path).unwrap();
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let asset_protocol_scope = app.asset_protocol_scope();
|
||||
let app = app.clone();
|
||||
let app_dir = app.path_resolver().app_data_dir();
|
||||
let app_dir = app.path().app_data_dir();
|
||||
|
||||
if let Some(app_dir) = app_dir {
|
||||
if let Ok(app_dir) = app_dir {
|
||||
let scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
|
||||
|
||||
let _ = fs_scope.forbid_file(&scope_state_path);
|
||||
|
||||
@@ -12,11 +12,11 @@ rust-version = "1.57"
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
tauri = { version = "1", features = ["api-all"] }
|
||||
tauri = { version = "2.0.0-alpha.8", features = ["api-all"] }
|
||||
tauri-plugin-single-instance = { path = "../../../" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1", features = [] }
|
||||
tauri-build = { version = "2.0.0-alpha.4", features = [] }
|
||||
|
||||
[features]
|
||||
default = [ "custom-protocol" ]
|
||||
|
||||
@@ -63,10 +63,7 @@ type Result<T> = std::result::Result<T, Error>;
|
||||
/// Resolves the App's **file path** from the `AppHandle` context
|
||||
/// object
|
||||
fn app_path<R: Runtime>(app: &AppHandle<R>) -> PathBuf {
|
||||
#[allow(deprecated)] // FIXME: Change to non-deprecated function in Tauri v2
|
||||
app.path_resolver()
|
||||
.app_dir()
|
||||
.expect("No App path was found!")
|
||||
app.path().app_config_dir().expect("No App path was found!")
|
||||
}
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
|
||||
@@ -10,7 +10,7 @@ use std::{
|
||||
io::Write,
|
||||
path::PathBuf,
|
||||
};
|
||||
use tauri::{AppHandle, Runtime};
|
||||
use tauri::{AppHandle, Manager, Runtime};
|
||||
|
||||
type SerializeFn = fn(&HashMap<String, JsonValue>) -> Result<Vec<u8>, Box<dyn std::error::Error>>;
|
||||
type DeserializeFn = fn(&[u8]) -> Result<HashMap<String, JsonValue>, Box<dyn std::error::Error>>;
|
||||
@@ -171,7 +171,7 @@ impl Store {
|
||||
/// Update the store from the on-disk state
|
||||
pub fn load<R: Runtime>(&mut self, app: &AppHandle<R>) -> Result<(), Error> {
|
||||
let app_dir = app
|
||||
.path_resolver()
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("failed to resolve app dir");
|
||||
let store_path = app_dir.join(&self.path);
|
||||
@@ -186,7 +186,7 @@ impl Store {
|
||||
/// Saves the store to disk
|
||||
pub fn save<R: Runtime>(&self, app: &AppHandle<R>) -> Result<(), Error> {
|
||||
let app_dir = app
|
||||
.path_resolver()
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("failed to resolve app dir");
|
||||
let store_path = app_dir.join(&self.path);
|
||||
|
||||
@@ -9,14 +9,14 @@ edition = "2021"
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tauri = { version = "1", features = [] }
|
||||
tauri = { version = "2.0.0-alpha.8", features = [] }
|
||||
tokio = { version = "1.11", features = ["net"] }
|
||||
futures-util = "0.3"
|
||||
tauri-plugin-websocket = { path = "../../../" }
|
||||
tokio-tungstenite = "0.15"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1", features = [] }
|
||||
tauri-build = { version = "2.0.0-alpha.4", features = [] }
|
||||
|
||||
[features]
|
||||
default = [ "custom-protocol" ]
|
||||
|
||||
@@ -69,7 +69,7 @@ pub trait AppHandleExt {
|
||||
|
||||
impl<R: Runtime> AppHandleExt for tauri::AppHandle<R> {
|
||||
fn save_window_state(&self, flags: StateFlags) -> Result<()> {
|
||||
if let Some(app_dir) = self.path_resolver().app_config_dir() {
|
||||
if let Ok(app_dir) = self.path().app_config_dir() {
|
||||
let state_path = app_dir.join(STATE_FILENAME);
|
||||
let cache = self.state::<WindowStateCache>();
|
||||
let mut state = cache.0.lock().unwrap();
|
||||
@@ -270,8 +270,8 @@ impl Builder {
|
||||
let flags = self.state_flags;
|
||||
PluginBuilder::new("window-state")
|
||||
.setup(|app, _api| {
|
||||
let cache: Arc<Mutex<HashMap<String, WindowState>>> = if let Some(app_dir) =
|
||||
app.path_resolver().app_config_dir()
|
||||
let cache: Arc<Mutex<HashMap<String, WindowState>>> = if let Ok(app_dir) =
|
||||
app.path().app_config_dir()
|
||||
{
|
||||
let state_path = app_dir.join(STATE_FILENAME);
|
||||
if state_path.exists() {
|
||||
|
||||
Reference in New Issue
Block a user