mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 14:45:37 +02:00
[cdc_rsync] Enable local syncing (#75)
Adds support for local syncs of files and folders on the same Windows machine, e.g. cdc_rsync C:\source C:\dest. The two main changes are - Skip the check whether the port is available remotely with PortManager. - Do not deploy cdc_rsync_server. - Run cdc_rsync_server directly, not through an SSH tunnel. The current implementation is not optimal as it starts cdc_rsync_server as a separate process and communicates to it via a TCP port.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "common/path.h"
|
||||
#include "common/platform.h"
|
||||
#include "common/remote_util.h"
|
||||
#include "common/util.h"
|
||||
|
||||
@@ -58,6 +59,28 @@ ServerArch::Type ServerArch::Detect(const std::string& destination) {
|
||||
return Type::kLinux;
|
||||
}
|
||||
|
||||
// static
|
||||
ServerArch::Type ServerArch::LocalType() {
|
||||
#if PLATFORM_WINDOWS
|
||||
return ServerArch::Type::kWindows;
|
||||
#elif PLATFORM_LINUX
|
||||
return ServerArch::Type::kLinux;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
std::string ServerArch::CdcRsyncFilename() {
|
||||
switch (LocalType()) {
|
||||
case Type::kWindows:
|
||||
return "cdc_rsync.exe";
|
||||
case Type::kLinux:
|
||||
return "cdc_rsync";
|
||||
default:
|
||||
assert(!kErrorArchTypeUnhandled);
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
ServerArch::ServerArch(Type type) : type_(type) {}
|
||||
|
||||
ServerArch::~ServerArch() {}
|
||||
|
||||
Reference in New Issue
Block a user