Transport Errors
- The 'push' and 'pull' commands now properly distinguish between a missing transport utility and other errors (thanks to Russell Steicke).
This commit is contained in:
@@ -34,68 +34,68 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
TransportRSYNC::TransportRSYNC(const Uri& uri) : Transport(uri)
|
||||
{
|
||||
_executable = "rsync";
|
||||
_executable = "rsync";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportRSYNC::send(const std::string& source)
|
||||
{
|
||||
if (_uri._host == "")
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
if (_uri._host == "")
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !_uri.is_directory())
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !_uri.is_directory())
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, _uri._path);
|
||||
|
||||
// cmd line is: rsync [--port=PORT] source [user@]host::path
|
||||
if (_uri._port != "")
|
||||
{
|
||||
_arguments.push_back ("--port=" + _uri._port);
|
||||
}
|
||||
// cmd line is: rsync [--port=PORT] source [user@]host::path
|
||||
if (_uri._port != "")
|
||||
{
|
||||
_arguments.push_back ("--port=" + _uri._port);
|
||||
}
|
||||
|
||||
_arguments.push_back (source);
|
||||
_arguments.push_back (source);
|
||||
|
||||
if (_uri._user != "")
|
||||
{
|
||||
_arguments.push_back (_uri._user + "@" + _uri._host + "::" + _uri._path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arguments.push_back (_uri._host + "::" + _uri._path);
|
||||
}
|
||||
if (_uri._user != "")
|
||||
{
|
||||
_arguments.push_back (_uri._user + "@" + _uri._host + "::" + _uri._path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arguments.push_back (_uri._host + "::" + _uri._path);
|
||||
}
|
||||
|
||||
if (execute ())
|
||||
if (execute ())
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_FAIL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportRSYNC::recv(std::string target)
|
||||
{
|
||||
if (_uri._host == "")
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
if (_uri._host == "")
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(_uri._path) && !is_directory(target))
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(_uri._path) && !is_directory(target))
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, target);
|
||||
|
||||
// cmd line is: rsync [--port=PORT] [user@]host::path target
|
||||
if (_uri._port != "")
|
||||
_arguments.push_back ("--port=" + _uri._port);
|
||||
// cmd line is: rsync [--port=PORT] [user@]host::path target
|
||||
if (_uri._port != "")
|
||||
_arguments.push_back ("--port=" + _uri._port);
|
||||
|
||||
if (_uri._user != "")
|
||||
{
|
||||
_arguments.push_back (_uri._user + "@" + _uri._host + "::" + _uri._path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arguments.push_back (_uri._host + "::" + _uri._path);
|
||||
}
|
||||
if (_uri._user != "")
|
||||
{
|
||||
_arguments.push_back (_uri._user + "@" + _uri._host + "::" + _uri._path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arguments.push_back (_uri._host + "::" + _uri._path);
|
||||
}
|
||||
|
||||
_arguments.push_back (target);
|
||||
_arguments.push_back (target);
|
||||
|
||||
if (execute ())
|
||||
if (execute ())
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_FAIL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user