Repository: tauri-apps/tauri (language: rust)

Issue:
[feat] clone `tauri::path::PathResolver`
### Describe the problem

I want to implement the Python binding for [`PathResolver`](https://docs.rs/tauri/2.2.5/tauri/path/struct.PathResolver.html) in WSH032/pytauri#58.

The problem is that [python class must own their data](https://pyo3.rs/v0.23.4/class.html#no-lifetime-parameters), but currently we can only get a reference `&PathResolver` via [`Manager::path`](https://docs.rs/tauri/2.2.5/tauri/trait.Manager.html?search=PathResolver#method.path).

Can Tauri derive `Clone` for `PathResolver`? This way, I can obtain its ownership.

### Describe the solution you'd like

```rust
// desktop
#[derive(Clone)]
pub struct PathResolver<R: Runtime>(pub(crate) AppHandle<R>);

// mobile
#[derive(Clone)]
pub struct PathResolver<R: Runtime>(pub(crate) PluginHandle<R>);
```

### Alternatives considered

_No response_

### Additional context

_No response_


Discussion / hints:
This should be alright since, it is just a wrapper type around `AppHandle`

Fix patch:
diff --git a/.changes/path-resolver-clone.md b/.changes/path-resolver-clone.md
new file mode 100644
index 000000000000..680e6c63ba6c
--- /dev/null
+++ b/.changes/path-resolver-clone.md
@@ -0,0 +1,5 @@
+---
+"tauri": "patch:enhance"
+---
+
+Derive `Clone` for `PathResolver` struct.
diff --git a/crates/tauri/src/path/android.rs b/crates/tauri/src/path/android.rs
index 3015e44808e7..902208fe8cc5 100644
--- a/crates/tauri/src/path/android.rs
+++ b/crates/tauri/src/path/android.rs
@@ -9,6 +9,12 @@ use std::path::PathBuf;
 /// A helper class to access the mobile path APIs.
 pub struct PathResolver<R: Runtime>(pub(crate) PluginHandle<R>);
 
+impl<R: Runtime> Clone for PathResolver<R> {
+  fn clone(&self) -> Self {
+    Self(self.0.clone())
+  }
+}
+
 #[derive(serde::Deserialize)]
 struct PathResponse {
   path: PathBuf,
diff --git a/crates/tauri/src/path/desktop.rs b/crates/tauri/src/path/desktop.rs
index 32463f993126..7a114fd520cc 100644
--- a/crates/tauri/src/path/desktop.rs
+++ b/crates/tauri/src/path/desktop.rs
@@ -9,6 +9,12 @@ use std::path::PathBuf;
 /// The path resolver is a helper class for general and application-specific path APIs.
 pub struct PathResolver<R: Runtime>(pub(crate) AppHandle<R>);
 
+impl<R: Runtime> Clone for PathResolver<R> {
+  fn clone(&self) -> Self {
+    Self(self.0.clone())
+  }
+}
+
 impl<R: Runtime> PathResolver<R> {
   /// Returns the path to the user's audio directory.
   ///


Test patch: