History

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

Thorsten Ball committed 2 years ago

Commit fc8749f1 parent 2a923e31 file · +18 −11Browse files

Unified · Split

crates/gpui/src/platform/linux/platform.rs+18−11
@@ -314,20 +314,27 @@ impl<P: LinuxClient + 'static> Platform for P { · 313 unmodified lines
314 let directory = directory.to_owned();314 let directory = directory.to_owned();
315 self.foreground_executor()315 self.foreground_executor()
316 .spawn(async move {316 .spawn(async move {
317 let result = SaveFileRequest::default()317 let request = SaveFileRequest::default()
318 .modal(true)318 .modal(true)
319 .title("Select new path")319 .title("Select new path")
320 .accept_label("Accept")320 .accept_label("Accept")
321 .send()321 .current_folder(directory);
322 .await322
323 .ok()323 let result = if let Ok(request) = request {
324 .and_then(|request| request.response().ok())324 request
325 .and_then(|response| {325 .send()
326 response326 .await
327 .uris()327 .ok()
328 .first()328 .and_then(|request| request.response().ok())
329 .and_then(|uri| uri.to_file_path().ok())329 .and_then(|response| {
330 });330 response
331 .uris()
332 .first()
333 .and_then(|uri| uri.to_file_path().ok())
334 })
335 } else {
336 None
337 };
331 338
332 done_tx.send(result);339 done_tx.send(result);
333 })340 })