I ran into an issue where a Save dialog that's been given a path and a filename doesn't open to the given path. I'm using Tauri, but I think the issue is in rfd, in the set_path function.
At the beginning, it appends the filename to the directory name. And then at the end, it calls file_url_with_path and passes is_dir = true, which makes me think that maybe it's a mistake to have pushed the filename onto the path? At least from the Apple docs on directoryURL it looks like that's meant to be a directory path without a filename.
pub fn set_path(&self, path: &Path, file_name: Option<&str>) {
// if file_name is some, and path is a dir
let path = if let (Some(name), true) = (file_name, path.is_dir()) {
let mut path = path.to_owned();
// add a name to the end of path
path.push(name);
path
} else {
path.to_owned()
};
if let Some(path) = path.to_str() {
unsafe {
let url = NSURL::file_url_with_path(path, true);
let () = msg_send![self.panel, setDirectoryURL: url];
}
}
}
I ran into an issue where a Save dialog that's been given a path and a filename doesn't open to the given path. I'm using Tauri, but I think the issue is in rfd, in the
set_path
function.At the beginning, it appends the filename to the directory name. And then at the end, it calls
file_url_with_path
and passesis_dir = true
, which makes me think that maybe it's a mistake to have pushed the filename onto the path? At least from the Apple docs on directoryURL it looks like that's meant to be a directory path without a filename.