Resolve the host-side target path for a downloaded *file*, following `cp`-style semantics. - If `dest_str` ends with `/` or already exists as a directory, the file is placed inside it as ` / `. - Otherwise `dest_str` is treated as the exact file path to write. `dest_exists_as_dir` is taken as a parameter (rather than queried inside) so this function stays pure and unit-testa
(
dest_str: &str,
source_basename: &str,
dest_exists_as_dir: bool,
)
| 922 | /// so this function stays pure and unit-testable; the caller performs the |
| 923 | /// filesystem check. |
| 924 | fn resolve_file_download_target( |
| 925 | dest_str: &str, |
| 926 | source_basename: &str, |
| 927 | dest_exists_as_dir: bool, |
| 928 | ) -> PathBuf { |
| 929 | let trailing_slash = dest_str.ends_with('/'); |
| 930 | let dest_path = Path::new(dest_str); |
| 931 | if trailing_slash || dest_exists_as_dir { |
| 932 | dest_path.join(source_basename) |
| 933 | } else { |
| 934 | dest_path.to_path_buf() |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | /// Push a list of files from a local directory into a sandbox using tar-over-SSH. |
| 939 | /// |
no outgoing calls