Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/fix-opener-open-path-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"opener": patch
"opener-js": patch
---
`open_path` now returns an error if the file does not exist
4 changes: 4 additions & 0 deletions plugins/opener/src/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Loading