SSH Remoting: Add the ability to resolve file paths on the remote host (#18250)
Release Notes: - N/A
This commit is contained in:
parent
d989183f94
commit
20c06545b6
5 changed files with 119 additions and 33 deletions
|
@ -108,6 +108,7 @@ impl HeadlessProject {
|
|||
session.subscribe_to_entity(SSH_PROJECT_ID, &settings_observer);
|
||||
|
||||
client.add_request_handler(cx.weak_model(), Self::handle_list_remote_directory);
|
||||
client.add_request_handler(cx.weak_model(), Self::handle_check_file_exists);
|
||||
|
||||
client.add_model_request_handler(Self::handle_add_worktree);
|
||||
client.add_model_request_handler(Self::handle_open_buffer_by_path);
|
||||
|
@ -298,4 +299,20 @@ impl HeadlessProject {
|
|||
}
|
||||
Ok(proto::ListRemoteDirectoryResponse { entries })
|
||||
}
|
||||
|
||||
pub async fn handle_check_file_exists(
|
||||
this: Model<Self>,
|
||||
envelope: TypedEnvelope<proto::CheckFileExists>,
|
||||
cx: AsyncAppContext,
|
||||
) -> Result<proto::CheckFileExistsResponse> {
|
||||
let fs = cx.read_model(&this, |this, _| this.fs.clone())?;
|
||||
let expanded = shellexpand::tilde(&envelope.payload.path).to_string();
|
||||
|
||||
let exists = fs.is_file(&PathBuf::from(expanded.clone())).await;
|
||||
|
||||
Ok(proto::CheckFileExistsResponse {
|
||||
exists,
|
||||
path: expanded,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue