From c9dbd9c66c291041b2fb76487a94191df97e288d Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 7 Apr 2023 20:41:45 -0300 Subject: [PATCH] chore(deps): update to upcoming tauri alpha.7 --- Cargo.lock | 39 ++++++++++++------------------ Cargo.toml | 8 ++++-- plugins/log/src/lib.rs | 3 ++- plugins/persisted-scope/src/lib.rs | 5 ++-- plugins/sql/src/plugin.rs | 6 ++--- plugins/store/src/store.rs | 6 ++--- plugins/window-state/src/lib.rs | 7 +++--- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3555c1a3..bd07fe31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4128,9 +4128,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "swift-rs" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eab55f44d02ced20ffa22fd5b4bd083ab59c940c7637d37fec4426b1a01d769" +checksum = "8fa67d647176dfa7bdc5775430a1cb339e0ea48fe24707424023a4b17eb9688e" dependencies = [ "base64 0.21.0", "serde", @@ -4246,9 +4246,8 @@ dependencies = [ [[package]] name = "tauri" -version = "2.0.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113835bb47f8cab6d1fb3b1a2e3d96ddd64730248638a5ab3f46a598c02a81c" +version = "2.0.0-alpha.6" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "anyhow", "bytes 1.4.0", @@ -4298,9 +4297,8 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383f94e1b46fb4e249e4eafbd0589ffbe02b241b49dadebd47640598a17e584e" +version = "2.0.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "anyhow", "cargo_toml", @@ -4318,9 +4316,8 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5914e68c4ba4d9b761373dcce86f6721de78c2ffd84f376b1e0fee9321c0fc7e" +version = "2.0.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "base64 0.21.0", "brotli", @@ -4344,9 +4341,8 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adedb0845af0d5840b54410f83135bb285ab372956678e0b12046a87999486fb" +version = "2.0.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "heck", "proc-macro2", @@ -4566,9 +4562,8 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.13.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c9ce3ab30f6a95a09131510a624d5de24455ba9e8fcae6a6fe9e0922f833c8" +version = "0.13.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "gtk", "http", @@ -4588,9 +4583,8 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.13.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e176af0987e4ced285bec0faf56eed0f13a1b3851d9176fa6758181f867cdc3" +version = "0.13.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "cocoa", "gtk", @@ -4609,9 +4603,8 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a488bb0c60e2ce9efbe8283a11299675e01f55caf12304889f8639b3c35713c" +version = "2.0.0-alpha.3" +source = "git+http://github.com/tauri-apps/tauri?branch=next#f0570d9feee05792cc720d26ef32da5eaed7f797" dependencies = [ "brotli", "ctor", diff --git a/Cargo.toml b/Cargo.toml index bbc07433..1d3c58fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ resolver = "2" [workspace.dependencies] serde = { version = "1", features = ["derive"] } log = "0.4" -tauri = "2.0.0-alpha.4" -tauri-build = "2.0.0-alpha.2" +tauri = "2.0.0-alpha.6" +tauri-build = "2.0.0-alpha.3" serde_json = "1" thiserror = "1" @@ -15,3 +15,7 @@ edition = "2021" authors = [ "Tauri Programme within The Commons Conservancy" ] license = "Apache-2.0 OR MIT" rust-version = "1.64" + +[patch.crates-io] +tauri = { git = "http://github.com/tauri-apps/tauri", branch = "next" } +tauri-build = { git = "http://github.com/tauri-apps/tauri", branch = "next" } \ No newline at end of file diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 66d534b4..746b5fc1 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -16,6 +16,7 @@ use std::{ path::{Path, PathBuf}, }; use tauri::{ + path::PathExt, plugin::{self, TauriPlugin}, Manager, Runtime, }; @@ -300,7 +301,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(); } diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index e93f5002..0c97e558 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; use tauri::{ + path::PathExt, plugin::{Builder, TauriPlugin}, FsScopeEvent, Manager, Runtime, }; @@ -40,9 +41,9 @@ pub fn init() -> TauriPlugin { #[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); diff --git a/plugins/sql/src/plugin.rs b/plugins/sql/src/plugin.rs index 656234b0..4fd604d7 100644 --- a/plugins/sql/src/plugin.rs +++ b/plugins/sql/src/plugin.rs @@ -14,6 +14,7 @@ use sqlx::{ }; use tauri::{ command, + path::PathExt, plugin::{Builder as PluginBuilder, TauriPlugin}, AppHandle, Manager, RunEvent, Runtime, State, }; @@ -63,10 +64,7 @@ type Result = std::result::Result; /// Resolves the App's **file path** from the `AppHandle` context /// object fn app_path(app: &AppHandle) -> 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")] diff --git a/plugins/store/src/store.rs b/plugins/store/src/store.rs index af106e30..cfd92719 100644 --- a/plugins/store/src/store.rs +++ b/plugins/store/src/store.rs @@ -10,7 +10,7 @@ use std::{ io::Write, path::PathBuf, }; -use tauri::{AppHandle, Runtime}; +use tauri::{path::PathExt, AppHandle, Runtime}; type SerializeFn = fn(&HashMap) -> Result, Box>; type DeserializeFn = fn(&[u8]) -> Result, Box>; @@ -171,7 +171,7 @@ impl Store { /// Update the store from the on-disk state pub fn load(&mut self, app: &AppHandle) -> 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(&self, app: &AppHandle) -> 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); diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 5a224ad3..0bf739eb 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -5,6 +5,7 @@ use bitflags::bitflags; use serde::{Deserialize, Serialize}; use tauri::{ + path::PathExt, plugin::{Builder as PluginBuilder, TauriPlugin}, LogicalSize, Manager, Monitor, PhysicalPosition, PhysicalSize, RunEvent, Runtime, Window, WindowEvent, @@ -69,7 +70,7 @@ pub trait AppHandleExt { impl AppHandleExt for tauri::AppHandle { 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::(); let mut state = cache.0.lock().unwrap(); @@ -270,8 +271,8 @@ impl Builder { let flags = self.state_flags; PluginBuilder::new("window-state") .setup(|app, _api| { - let cache: Arc>> = if let Some(app_dir) = - app.path_resolver().app_config_dir() + let cache: Arc>> = if let Ok(app_dir) = + app.path().app_config_dir() { let state_path = app_dir.join(STATE_FILENAME); if state_path.exists() {