mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
fix: mobile clippy warnings
This commit is contained in:
@@ -13,7 +13,6 @@ use tauri::{
|
|||||||
plugin::{Builder, PluginHandle, TauriPlugin},
|
plugin::{Builder, PluginHandle, TauriPlugin},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use models::*;
|
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod models;
|
mod models;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
)]
|
)]
|
||||||
|
|
||||||
use tauri::{
|
use tauri::{
|
||||||
Manager, RunEvent, Runtime,
|
Manager, Runtime,
|
||||||
plugin::{Builder, TauriPlugin},
|
plugin::{Builder, TauriPlugin},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
|||||||
})
|
})
|
||||||
.on_event(|_app, _event| {
|
.on_event(|_app, _event| {
|
||||||
#[cfg(desktop)]
|
#[cfg(desktop)]
|
||||||
if let RunEvent::Exit = _event {
|
if let tauri::RunEvent::Exit = _event {
|
||||||
_app.clipboard().cleanup();
|
_app.clipboard().cleanup();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ impl<R: Runtime> Fs<R> {
|
|||||||
FilePath::Url(u) => self
|
FilePath::Url(u) => self
|
||||||
.resolve_content_uri(u.to_string(), opts.android_mode())
|
.resolve_content_uri(u.to_string(), opts.android_mode())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
std::io::Error::new(
|
std::io::Error::other(format!("failed to open file: {e}"))
|
||||||
std::io::ErrorKind::Other,
|
|
||||||
format!("failed to open file: {e}"),
|
|
||||||
)
|
|
||||||
}),
|
}),
|
||||||
FilePath::Path(p) => {
|
FilePath::Path(p) => {
|
||||||
// tauri::utils::platform::resources_dir() returns a PathBuf with the Android asset URI prefix
|
// tauri::utils::platform::resources_dir() returns a PathBuf with the Android asset URI prefix
|
||||||
@@ -56,10 +53,7 @@ impl<R: Runtime> Fs<R> {
|
|||||||
{
|
{
|
||||||
self.resolve_content_uri(p.to_string_lossy(), opts.android_mode())
|
self.resolve_content_uri(p.to_string_lossy(), opts.android_mode())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
std::io::Error::new(
|
std::io::Error::other(format!("failed to open file: {e}"))
|
||||||
std::io::ErrorKind::Other,
|
|
||||||
format!("failed to open file: {e}"),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
std::fs::OpenOptions::from(opts).open(p)
|
std::fs::OpenOptions::from(opts).open(p)
|
||||||
|
|||||||
+125
-128
@@ -159,26 +159,26 @@ impl<R: Runtime> Drop for FileHandle<R> {
|
|||||||
// Only clean up if we're tracking this resource
|
// Only clean up if we're tracking this resource
|
||||||
// If start_accessing_security_scoped_resource was used, it won't be in our tracking
|
// If start_accessing_security_scoped_resource was used, it won't be in our tracking
|
||||||
// and we shouldn't interfere
|
// and we shouldn't interfere
|
||||||
if let FilePath::Url(url) = file_path {
|
if let FilePath::Url(url) = file_path
|
||||||
if url.scheme() == "file" {
|
&& url.scheme() == "file"
|
||||||
let security_scoped_resources =
|
{
|
||||||
self.app_handle.state::<crate::SecurityScopedResources>();
|
let security_scoped_resources =
|
||||||
|
self.app_handle.state::<crate::SecurityScopedResources>();
|
||||||
|
|
||||||
// Only clean up if it's not tracked manually
|
// Only clean up if it's not tracked manually
|
||||||
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Stopping accessing security-scoped resource for URL: {url} on drop"
|
"Stopping accessing security-scoped resource for URL: {url} on drop"
|
||||||
);
|
);
|
||||||
let _ = self
|
let _ = self
|
||||||
.app_handle
|
.app_handle
|
||||||
.fs()
|
.fs()
|
||||||
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()));
|
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()));
|
||||||
security_scoped_resources.remove(url.as_str());
|
security_scoped_resources.remove(url.as_str());
|
||||||
} else {
|
} else {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)"
|
"Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)"
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,26 +237,24 @@ impl<R: Runtime> Drop for PathHandle<R> {
|
|||||||
// Only clean up if we're tracking this resource (i.e., resolve_path started it)
|
// Only clean up if we're tracking this resource (i.e., resolve_path started it)
|
||||||
// If start_accessing_security_scoped_resource was used, it won't be in our tracking
|
// If start_accessing_security_scoped_resource was used, it won't be in our tracking
|
||||||
// and we shouldn't interfere
|
// and we shouldn't interfere
|
||||||
if let FilePath::Url(url) = file_path {
|
if let FilePath::Url(url) = file_path
|
||||||
if url.scheme() == "file" {
|
&& url.scheme() == "file"
|
||||||
let security_scoped_resources =
|
{
|
||||||
self.app_handle.state::<crate::SecurityScopedResources>();
|
let security_scoped_resources =
|
||||||
|
self.app_handle.state::<crate::SecurityScopedResources>();
|
||||||
|
|
||||||
// Only clean up if it's not tracked manually
|
// Only clean up if it's not tracked manually
|
||||||
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
||||||
log::debug!(
|
log::debug!("Stopping accessing security-scoped resource for URL: {url} on drop");
|
||||||
"Stopping accessing security-scoped resource for URL: {url} on drop"
|
let _ = self
|
||||||
);
|
.app_handle
|
||||||
let _ = self
|
.fs()
|
||||||
.app_handle
|
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()));
|
||||||
.fs()
|
security_scoped_resources.remove(url.as_str());
|
||||||
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()));
|
} else {
|
||||||
security_scoped_resources.remove(url.as_str());
|
log::debug!(
|
||||||
} else {
|
"Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)"
|
||||||
log::debug!(
|
);
|
||||||
"Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1280,50 +1278,49 @@ pub fn start_accessing_security_scoped_resource<R: Runtime>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Only handle file URLs
|
// Only handle file URLs
|
||||||
if let FilePath::Url(url) = &file_path {
|
if let FilePath::Url(url) = &file_path
|
||||||
if url.scheme() == "file" {
|
&& url.scheme() == "file"
|
||||||
use objc2_foundation::{NSString, NSURL};
|
{
|
||||||
|
use objc2_foundation::{NSString, NSURL};
|
||||||
|
|
||||||
let url_nsstring = NSString::from_str(url.as_str());
|
let url_nsstring = NSString::from_str(url.as_str());
|
||||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
let ns_url = NSURL::URLWithString(&url_nsstring);
|
||||||
if let Some(ns_url) = ns_url {
|
if let Some(ns_url) = ns_url {
|
||||||
// Check if already active
|
// Check if already active
|
||||||
let security_scoped_resources =
|
let security_scoped_resources = webview.state::<crate::SecurityScopedResources>();
|
||||||
webview.state::<crate::SecurityScopedResources>();
|
if security_scoped_resources.is_tracked_manually(url.as_str()) {
|
||||||
if security_scoped_resources.is_tracked_manually(url.as_str()) {
|
log::debug!(
|
||||||
|
"Security-scoped resource already active for URL: {}",
|
||||||
|
url.as_str()
|
||||||
|
);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start accessing the security-scoped resource
|
||||||
|
unsafe {
|
||||||
|
let success = ns_url.startAccessingSecurityScopedResource();
|
||||||
|
if success {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Security-scoped resource already active for URL: {}",
|
"Started accessing security-scoped resource for URL: {}",
|
||||||
url.as_str()
|
url.as_str()
|
||||||
);
|
);
|
||||||
return Ok(());
|
security_scoped_resources.track_manually(url.as_str().to_string());
|
||||||
|
} else {
|
||||||
|
log::warn!(
|
||||||
|
"Failed to start accessing security-scoped resource for URL: {}",
|
||||||
|
url.as_str()
|
||||||
|
);
|
||||||
|
return Err(CommandError::from(format!(
|
||||||
|
"Failed to start accessing security-scoped resource for URL: {}",
|
||||||
|
url.as_str()
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start accessing the security-scoped resource
|
|
||||||
unsafe {
|
|
||||||
let success = ns_url.startAccessingSecurityScopedResource();
|
|
||||||
if success {
|
|
||||||
log::debug!(
|
|
||||||
"Started accessing security-scoped resource for URL: {}",
|
|
||||||
url.as_str()
|
|
||||||
);
|
|
||||||
security_scoped_resources.track_manually(url.as_str().to_string());
|
|
||||||
} else {
|
|
||||||
log::warn!(
|
|
||||||
"Failed to start accessing security-scoped resource for URL: {}",
|
|
||||||
url.as_str()
|
|
||||||
);
|
|
||||||
return Err(CommandError::from(format!(
|
|
||||||
"Failed to start accessing security-scoped resource for URL: {}",
|
|
||||||
url.as_str()
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Err(CommandError::from(format!(
|
|
||||||
"Failed to create NSURL from URL: {}",
|
|
||||||
url.as_str()
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return Err(CommandError::from(format!(
|
||||||
|
"Failed to create NSURL from URL: {}",
|
||||||
|
url.as_str()
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1352,31 +1349,31 @@ pub fn stop_accessing_security_scoped_resource<R: Runtime>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Only handle file URLs
|
// Only handle file URLs
|
||||||
if let FilePath::Url(url) = file_path {
|
if let FilePath::Url(url) = file_path
|
||||||
if url.scheme() == "file" {
|
&& url.scheme() == "file"
|
||||||
let security_scoped_resources = webview.state::<crate::SecurityScopedResources>();
|
{
|
||||||
|
let security_scoped_resources = webview.state::<crate::SecurityScopedResources>();
|
||||||
|
|
||||||
// Check if it's tracked
|
// Check if it's tracked
|
||||||
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
||||||
log::debug!(
|
|
||||||
"Security-scoped resource not tracked as active for URL: {}",
|
|
||||||
url.as_str()
|
|
||||||
);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop accessing the security-scoped resource
|
|
||||||
webview
|
|
||||||
.fs()
|
|
||||||
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()))?;
|
|
||||||
|
|
||||||
// Remove from tracking
|
|
||||||
security_scoped_resources.remove(url.as_str());
|
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Stopped accessing security-scoped resource for URL: {}",
|
"Security-scoped resource not tracked as active for URL: {}",
|
||||||
url.as_str()
|
url.as_str()
|
||||||
);
|
);
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop accessing the security-scoped resource
|
||||||
|
webview
|
||||||
|
.fs()
|
||||||
|
.stop_accessing_security_scoped_resource(FilePath::Url(url.clone()))?;
|
||||||
|
|
||||||
|
// Remove from tracking
|
||||||
|
security_scoped_resources.remove(url.as_str());
|
||||||
|
log::debug!(
|
||||||
|
"Stopped accessing security-scoped resource for URL: {}",
|
||||||
|
url.as_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1518,47 +1515,47 @@ pub fn resolve_path<R: Runtime>(
|
|||||||
// On iOS, start accessing security-scoped resource if the path is a file URL
|
// On iOS, start accessing security-scoped resource if the path is a file URL
|
||||||
// Only if it hasn't been started already via start_accessing_security_scoped_resource
|
// Only if it hasn't been started already via start_accessing_security_scoped_resource
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
if let SafeFilePath::Url(url) = &path {
|
if let SafeFilePath::Url(url) = &path
|
||||||
if url.scheme() == "file" {
|
&& url.scheme() == "file"
|
||||||
use objc2_foundation::{NSString, NSURL};
|
{
|
||||||
|
use objc2_foundation::{NSString, NSURL};
|
||||||
|
|
||||||
let security_scoped_resources = webview.state::<crate::SecurityScopedResources>();
|
let security_scoped_resources = webview.state::<crate::SecurityScopedResources>();
|
||||||
|
|
||||||
// Check if already active (started via start_accessing_security_scoped_resource)
|
// Check if already active (started via start_accessing_security_scoped_resource)
|
||||||
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
if !security_scoped_resources.is_tracked_manually(url.as_str()) {
|
||||||
let url_nsstring = NSString::from_str(url.as_str());
|
let url_nsstring = NSString::from_str(url.as_str());
|
||||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
let ns_url = NSURL::URLWithString(&url_nsstring);
|
||||||
if let Some(ns_url) = ns_url {
|
if let Some(ns_url) = ns_url {
|
||||||
// Start accessing the security-scoped resource
|
// Start accessing the security-scoped resource
|
||||||
// This is required for files outside the app's sandbox (e.g., from file picker)
|
// This is required for files outside the app's sandbox (e.g., from file picker)
|
||||||
unsafe {
|
unsafe {
|
||||||
let success = ns_url.startAccessingSecurityScopedResource();
|
let success = ns_url.startAccessingSecurityScopedResource();
|
||||||
if success {
|
if success {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Started accessing security-scoped resource for URL: {} (via resolve_path)",
|
"Started accessing security-scoped resource for URL: {} (via resolve_path)",
|
||||||
url.as_str()
|
url.as_str()
|
||||||
);
|
);
|
||||||
// Track it so we know to clean it up
|
// Track it so we know to clean it up
|
||||||
security_scoped_resources.track_manually(url.as_str().to_string());
|
security_scoped_resources.track_manually(url.as_str().to_string());
|
||||||
} else {
|
} else {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"Failed to start accessing security-scoped resource for URL: {}",
|
"Failed to start accessing security-scoped resource for URL: {}",
|
||||||
url.as_str()
|
url.as_str()
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log::debug!(
|
|
||||||
"Failed to create NSURL from URL: {}, ignoring security-scoped resource access request",
|
|
||||||
url.as_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Security-scoped resource already active for URL: {} (started via start_accessing_security_scoped_resource), skipping",
|
"Failed to create NSURL from URL: {}, ignoring security-scoped resource access request",
|
||||||
url.as_str()
|
url.as_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log::debug!(
|
||||||
|
"Security-scoped resource already active for URL: {} (started via start_accessing_security_scoped_resource), skipping",
|
||||||
|
url.as_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ impl<R: Runtime> Fs<R> {
|
|||||||
|
|
||||||
// Create NSURL from the URL string
|
// Create NSURL from the URL string
|
||||||
// URLWithString may return None for invalid URLs, but file:// URLs should be valid
|
// URLWithString may return None for invalid URLs, but file:// URLs should be valid
|
||||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
let ns_url = NSURL::URLWithString(&url_nsstring);
|
||||||
if let Some(ns_url) = ns_url {
|
if let Some(ns_url) = ns_url {
|
||||||
// Start accessing the security-scoped resource
|
// Start accessing the security-scoped resource
|
||||||
// This is required for files outside the app's sandbox (e.g., from file picker)
|
// This is required for files outside the app's sandbox (e.g., from file picker)
|
||||||
@@ -127,7 +127,7 @@ impl<R: Runtime> Fs<R> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let url_nsstring = NSString::from_str(&url_string);
|
let url_nsstring = NSString::from_str(&url_string);
|
||||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
let ns_url = NSURL::URLWithString(&url_nsstring);
|
||||||
if let Some(ns_url) = ns_url {
|
if let Some(ns_url) = ns_url {
|
||||||
// Stop accessing the security-scoped resource
|
// Stop accessing the security-scoped resource
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ mod android {
|
|||||||
///
|
///
|
||||||
/// It maps to the `NotificationManager.IMPORTANCE_*` constants and is serialized as its
|
/// It maps to the `NotificationManager.IMPORTANCE_*` constants and is serialized as its
|
||||||
/// integer value. Only available on Android.
|
/// integer value. Only available on Android.
|
||||||
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr)]
|
#[derive(Debug, Default, Clone, Copy, Serialize_repr, Deserialize_repr)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Importance {
|
pub enum Importance {
|
||||||
/// The notifications are not shown.
|
/// The notifications are not shown.
|
||||||
@@ -737,17 +737,12 @@ mod android {
|
|||||||
/// The notifications are shown and make a sound.
|
/// The notifications are shown and make a sound.
|
||||||
///
|
///
|
||||||
/// This is the value used when the channel does not define an importance.
|
/// This is the value used when the channel does not define an importance.
|
||||||
|
#[default]
|
||||||
Default = 3,
|
Default = 3,
|
||||||
/// The notifications are shown, make a sound and pop up as a heads-up notification.
|
/// The notifications are shown, make a sound and pop up as a heads-up notification.
|
||||||
High = 4,
|
High = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Importance {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// How much of a notification is shown on the lock screen.
|
/// How much of a notification is shown on the lock screen.
|
||||||
///
|
///
|
||||||
/// It maps to the `Notification.VISIBILITY_*` constants and is serialized as its
|
/// It maps to the `Notification.VISIBILITY_*` constants and is serialized as its
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
|
|||||||
///
|
///
|
||||||
/// - **Android / iOS:** Unsupported.
|
/// - **Android / iOS:** Unsupported.
|
||||||
pub fn reveal_item_in_dir<P: AsRef<Path>>(path: P) -> crate::Result<()> {
|
pub fn reveal_item_in_dir<P: AsRef<Path>>(path: P) -> crate::Result<()> {
|
||||||
let path = canonicalize(path.as_ref())?;
|
let _path = canonicalize(path.as_ref())?;
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
windows,
|
windows,
|
||||||
@@ -21,7 +21,7 @@ pub fn reveal_item_in_dir<P: AsRef<Path>>(path: P) -> crate::Result<()> {
|
|||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
return imp::reveal_items_in_dir(&[path]);
|
return imp::reveal_items_in_dir(&[_path]);
|
||||||
|
|
||||||
#[cfg(not(any(
|
#[cfg(not(any(
|
||||||
windows,
|
windows,
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ impl<R: Runtime> Shell<R> {
|
|||||||
/// See [`crate::open::open`] for how it handles security-related measures.
|
/// See [`crate::open::open`] for how it handles security-related measures.
|
||||||
#[cfg(mobile)]
|
#[cfg(mobile)]
|
||||||
#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")]
|
#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn open(&self, path: impl Into<String>, _with: Option<open::Program>) -> Result<()> {
|
pub fn open(&self, path: impl Into<String>, _with: Option<open::Program>) -> Result<()> {
|
||||||
self.mobile_plugin_handle
|
self.mobile_plugin_handle
|
||||||
.run_mobile_plugin("open", path.into())
|
.run_mobile_plugin("open", path.into())
|
||||||
|
|||||||
@@ -8,15 +8,20 @@
|
|||||||
)]
|
)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
let builder = tauri::Builder::default();
|
||||||
.plugin(
|
|
||||||
tauri_plugin_single_instance::Builder::new()
|
// single-instance is only available on desktop
|
||||||
.callback(move |app, argv, cwd| {
|
#[cfg(desktop)]
|
||||||
println!("{}, {argv:?}, {cwd}", app.package_info().name);
|
let builder = builder.plugin(
|
||||||
})
|
tauri_plugin_single_instance::Builder::new()
|
||||||
.dbus_id("org.Tauri.SIExampleApp".to_owned())
|
.callback(move |app, argv, cwd| {
|
||||||
.build(),
|
println!("{}, {argv:?}, {cwd}", app.package_info().name);
|
||||||
)
|
})
|
||||||
|
.dbus_id("org.Tauri.SIExampleApp".to_owned())
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
|
||||||
|
builder
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
io::Cursor,
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
use std::ffi::OsStr;
|
|
||||||
|
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
@@ -26,6 +23,10 @@ use reqwest::{
|
|||||||
};
|
};
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, de::Error as DeError};
|
use serde::{Deserialize, Deserializer, Serialize, de::Error as DeError};
|
||||||
|
#[cfg(windows)]
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
#[cfg(desktop)]
|
||||||
|
use std::io::Cursor;
|
||||||
use tauri::{
|
use tauri::{
|
||||||
AppHandle, Resource, Runtime,
|
AppHandle, Resource, Runtime,
|
||||||
utils::{
|
utils::{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#![cfg(any(target_os = "linux", target_os = "macos", windows))]
|
||||||
#![allow(dead_code, unused_imports)]
|
#![allow(dead_code, unused_imports)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
@@ -376,7 +377,7 @@ fn stage_app_under_test(root_dir: &Path, target: &str, bundle_target: BundleTarg
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
return staged;
|
staged
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#![cfg(any(target_os = "linux", target_os = "macos", windows))]
|
||||||
#![allow(dead_code, unused_imports)]
|
#![allow(dead_code, unused_imports)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
Reference in New Issue
Block a user