mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
fix(opener): return error if path not exists (#2253)
This commit is contained in:
@@ -53,5 +53,9 @@ pub fn open_url<P: AsRef<str>, S: AsRef<str>>(url: P, with: Option<S>) -> crate:
|
||||
/// ```
|
||||
pub fn open_path<P: AsRef<Path>, S: AsRef<str>>(path: P, with: Option<S>) -> crate::Result<()> {
|
||||
let path = path.as_ref();
|
||||
if with.is_none() {
|
||||
// Returns an IO error if not exists, and besides `exists()` is a shorthand for `metadata()`
|
||||
_ = path.metadata()?;
|
||||
}
|
||||
open(path, with)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user