mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 12:25:35 +02:00
Expand path variables for sync destination (#18)
Expand path variables for sync destination Running commands like cdc_rsync C:\assets\* host:~/assets -vr would create a directory called ~assets. This CL expands path variables properly.
This commit is contained in:
@@ -303,7 +303,7 @@ absl::Status CdcRsyncServer::HandleSetOptions() {
|
||||
existing_ = request.existing();
|
||||
copy_dest_ = request.copy_dest();
|
||||
|
||||
// (internal): Support \ instead of / in destination folders.
|
||||
// Support \ instead of / in destination folders.
|
||||
path::FixPathSeparators(&destination_);
|
||||
path::EnsureEndsWithPathSeparator(&destination_);
|
||||
if (!copy_dest_.empty()) {
|
||||
@@ -311,6 +311,13 @@ absl::Status CdcRsyncServer::HandleSetOptions() {
|
||||
path::EnsureEndsWithPathSeparator(©_dest_);
|
||||
}
|
||||
|
||||
// Expand e.g. ~.
|
||||
status = path::ExpandPathVariables(&destination_);
|
||||
if (!status.ok()) {
|
||||
return WrapStatus(status, "Failed to expand destination '%s'",
|
||||
destination_);
|
||||
}
|
||||
|
||||
assert(path_filter_.IsEmpty());
|
||||
for (int n = 0; n < request.filter_rules_size(); ++n) {
|
||||
std::string fixed_pattern = request.filter_rules(n).pattern();
|
||||
|
||||
Reference in New Issue
Block a user