mirror of
https://github.com/veeso/termscp.git
synced 2025-12-06 17:15:35 -08:00
fix(bookmarks): Local directory path is not switching to what's specified in the bookmark
closes #316
This commit is contained in:
@@ -44,6 +44,10 @@
|
||||
|
||||
Released on ??
|
||||
|
||||
- [issue 316](https://github.com/veeso/termscp/issues/316): Local directory path is not switching to what's specified in the bookmark. Now the local directory path is correctly set following this hierarchy:
|
||||
1. Local directory path specified for the host bridge
|
||||
2. Local directory path specified in the bookmark
|
||||
3. Working directory
|
||||
- [issue 317](https://github.com/veeso/termscp/issues/317): the return value of `--version` should be `0`
|
||||
- [issue 319](https://github.com/veeso/termscp/issues/319): fixed a crash when the local directory specified in the auth form does not exist
|
||||
- [issue 327](https://github.com/veeso/termscp/issues/327): fixed a panic when trying to go up from local directory on localhost in the auth form
|
||||
|
||||
@@ -90,13 +90,18 @@ impl ActivityManager {
|
||||
)),
|
||||
host_params.password.as_deref(),
|
||||
),
|
||||
Remote::None => self.set_host_params(
|
||||
HostParams::HostBridge(HostBridgeParams::Localhost(
|
||||
env::current_dir()
|
||||
.map_err(|e| format!("Could not get current directory: {e}"))?,
|
||||
)),
|
||||
None,
|
||||
),
|
||||
Remote::None => {
|
||||
// local dir is remote_args.local_dir if set, otherwise current dir
|
||||
let local_dir = remote_args
|
||||
.local_dir
|
||||
.unwrap_or_else(|| env::current_dir().unwrap());
|
||||
debug!("host bridge is None, setting local dir to {:?}", local_dir,);
|
||||
|
||||
self.set_host_params(
|
||||
HostParams::HostBridge(HostBridgeParams::Localhost(local_dir)),
|
||||
None,
|
||||
)
|
||||
}
|
||||
}?;
|
||||
|
||||
// set remote
|
||||
|
||||
@@ -83,8 +83,16 @@ impl AuthActivity {
|
||||
}
|
||||
|
||||
fn collect_localhost_host_params(&self) -> Result<HostBridgeParams, &'static str> {
|
||||
// get remote local path
|
||||
let remote_local_path = self.get_input_local_directory(FormTab::Remote);
|
||||
|
||||
// Local path is:
|
||||
// - the input local path if set
|
||||
// - the remote local path if set
|
||||
// - the current directory if neither is set
|
||||
let path = self
|
||||
.get_input_local_directory(FormTab::HostBridge)
|
||||
.or(remote_local_path)
|
||||
.unwrap_or_else(|| env::current_dir().unwrap_or_default());
|
||||
|
||||
Ok(HostBridgeParams::Localhost(path))
|
||||
|
||||
@@ -36,6 +36,9 @@ impl AuthActivity {
|
||||
return None;
|
||||
};
|
||||
|
||||
debug!("Remote params: {:?}", remote_params);
|
||||
debug!("Host bridge params: {:?}", host_bridge_params);
|
||||
|
||||
self.save_recent();
|
||||
// Set file transfer params to context
|
||||
self.context_mut().set_remote_params(remote_params);
|
||||
|
||||
Reference in New Issue
Block a user