1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 * CommunicationProtocolRsync.cxx :
28 #include <libbatch_config.h>
31 #include "CommunicationProtocolRsync.hxx"
37 CommunicationProtocolRsync::CommunicationProtocolRsync()
38 : CommunicationProtocolSSH()
43 vector<string> CommunicationProtocolRsync::getCopyCommandArgs(const string & sourcePath,
44 const string & sourceHost,
45 const string & sourceUser,
46 const string & destinationPath,
47 const string & destinationHost,
48 const string & destinationUser) const
54 if(Utils::isOption(sourcePath))
55 fullSource += sourcePath;
58 if (sourceHost.size() != 0) {
59 if (sourceUser.size() != 0) {
60 fullSource += sourceUser + "@";
62 fullSource += sourceHost + ":";
67 fullSource += sourcePath;
73 string fullDestination;
74 if (destinationHost.size() != 0) {
75 if (destinationUser.size() != 0) {
76 fullDestination += destinationUser + "@";
78 fullDestination += destinationHost + ":";
81 fullDestination += "'";
83 fullDestination += destinationPath;
85 fullDestination += "'";
88 // Option -p is used to keep the same permissions for the destination file
89 // (particularly useful to keep scripts executable when copying them)
90 cmd.push_back(RSYNC_COMMAND);
91 if(!Utils::isOption(sourcePath))
95 if(Utils::usesRsyncRelativePath(sourcePath))
98 cmd.push_back(fullSource);
99 cmd.push_back(fullDestination);