Skip to content

Commit

Permalink
fix(FileDialog): fallback to current dir if path is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Nov 7, 2022
1 parent 7a0ab7a commit 45e7ba9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/file_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ impl FileDialog {
/// * Windows
/// * Mac
pub fn set_directory<P: AsRef<Path>>(mut self, path: P) -> Self {
let mut path = path.as_ref();
if path.to_str().map(|p|p.is_empty()).unwrap_or(false) {
path = Path::new(".")
}
self.starting_directory = Some(path.as_ref().into());
self
}
Expand Down

0 comments on commit 45e7ba9

Please sign in to comment.