diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-06 02:27:06 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-06 02:27:06 +0300 |
| commit | 9e9bc8a144667a6b7debfd4f0c7a31ff0e11493a (patch) | |
| tree | 03f1259f91fd9edeacfd4b904f2e84d4acf25232 /src/platform/client_state.rs | |
| parent | 35b0dff96579f099e0436290085024424ffb289c (diff) | |
feat: manage multiple ssh machines from one client (#3670)
Diffstat (limited to 'src/platform/client_state.rs')
| -rw-r--r-- | src/platform/client_state.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/platform/client_state.rs b/src/platform/client_state.rs new file mode 100644 index 00000000..d339bae8 --- /dev/null +++ b/src/platform/client_state.rs @@ -0,0 +1,32 @@ +use std::path::Path; + +#[cfg(not(windows))] +pub(crate) fn create_private_state_file(path: &Path) -> std::io::Result<std::fs::File> { + super::create_remote_ssh_config_file(path) +} + +#[cfg(windows)] +pub(crate) fn create_private_state_file(path: &Path) -> std::io::Result<std::fs::File> { + super::windows::create_remote_ssh_config_file(path) +} + +#[cfg(not(windows))] +pub(crate) fn replace_file(source: &Path, destination: &Path) -> std::io::Result<()> { + std::fs::rename(source, destination) +} + +#[cfg(windows)] +pub(crate) fn replace_file(source: &Path, destination: &Path) -> std::io::Result<()> { + super::windows::replace_file(source, destination) +} + +#[cfg(not(windows))] +pub(crate) fn sync_parent_directory(path: &Path) -> std::io::Result<()> { + std::fs::File::open(path)?.sync_all() +} + +#[cfg(windows)] +pub(crate) fn sync_parent_directory(_path: &Path) -> std::io::Result<()> { + // replace_file uses MOVEFILE_WRITE_THROUGH on Windows. + Ok(()) +} |
