linux: Set directory in SaveFileRequest dialog (#13850)
This has been bugging me for a while. If you create a new file and then save it, the dialogue would show the home directory and not the folder that you were in. This fixes it. Release Notes: - N/A
This commit is contained in:
parent
2a923e338f
commit
fc8749ffd7
1 changed files with 18 additions and 11 deletions
|
@ -314,20 +314,27 @@ impl<P: LinuxClient + 'static> Platform for P {
|
||||||
let directory = directory.to_owned();
|
let directory = directory.to_owned();
|
||||||
self.foreground_executor()
|
self.foreground_executor()
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let result = SaveFileRequest::default()
|
let request = SaveFileRequest::default()
|
||||||
.modal(true)
|
.modal(true)
|
||||||
.title("Select new path")
|
.title("Select new path")
|
||||||
.accept_label("Accept")
|
.accept_label("Accept")
|
||||||
.send()
|
.current_folder(directory);
|
||||||
.await
|
|
||||||
.ok()
|
let result = if let Ok(request) = request {
|
||||||
.and_then(|request| request.response().ok())
|
request
|
||||||
.and_then(|response| {
|
.send()
|
||||||
response
|
.await
|
||||||
.uris()
|
.ok()
|
||||||
.first()
|
.and_then(|request| request.response().ok())
|
||||||
.and_then(|uri| uri.to_file_path().ok())
|
.and_then(|response| {
|
||||||
});
|
response
|
||||||
|
.uris()
|
||||||
|
.first()
|
||||||
|
.and_then(|uri| uri.to_file_path().ok())
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
done_tx.send(result);
|
done_tx.send(result);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue