summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-18 22:15:10 +0100
committerCarl Hetherington <cth@carlh.net>2016-04-18 22:15:10 +0100
commitf71c67d250140c16aaf6d127f86645919435753f (patch)
tree1c4903b5b14cb2d44bcb031dedb4a0bc2e7b6697 /src/lib
parent52a7ca2de15ad04c04b9fe49151948a2ee894033 (diff)
Use generic_string() in a couple of places to avoid unwanted backslashes in filenames.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/curl_uploader.cc3
-rw-r--r--src/lib/scp_uploader.cc6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/curl_uploader.cc b/src/lib/curl_uploader.cc
index 11c389307..48f982482 100644
--- a/src/lib/curl_uploader.cc
+++ b/src/lib/curl_uploader.cc
@@ -76,7 +76,8 @@ CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path
{
curl_easy_setopt (
_curl, CURLOPT_URL,
- String::compose ("ftp://%1/%2/%3", Config::instance()->tms_ip(), Config::instance()->tms_path(), to.string ()).c_str ()
+ /* Use generic_string so that we get forward-slashes in the path, even on Windows */
+ String::compose ("ftp://%1/%2/%3", Config::instance()->tms_ip(), Config::instance()->tms_path(), to.generic_string ()).c_str ()
);
_file = fopen_boost (from, "rb");
diff --git a/src/lib/scp_uploader.cc b/src/lib/scp_uploader.cc
index 18ace439b..603d53cdf 100644
--- a/src/lib/scp_uploader.cc
+++ b/src/lib/scp_uploader.cc
@@ -81,7 +81,8 @@ SCPUploader::~SCPUploader ()
void
SCPUploader::create_directory (boost::filesystem::path directory)
{
- int const r = ssh_scp_push_directory (_scp, directory.string().c_str(), S_IRWXU);
+ /* Use generic_string so that we get forward-slashes in the path, even on Windows */
+ int const r = ssh_scp_push_directory (_scp, directory.generic_string().c_str(), S_IRWXU);
if (r != SSH_OK) {
throw NetworkError (String::compose (_("Could not create remote directory %1 (%2)"), directory, ssh_get_error (_session)));
}
@@ -91,7 +92,8 @@ void
SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size)
{
boost::uintmax_t to_do = boost::filesystem::file_size (from);
- ssh_scp_push_file (_scp, to.string().c_str(), to_do, S_IRUSR | S_IWUSR);
+ /* Use generic_string so that we get forward-slashes in the path, even on Windows */
+ ssh_scp_push_file (_scp, to.generic_string().c_str(), to_do, S_IRUSR | S_IWUSR);
FILE* f = fopen_boost (from, "rb");
if (f == 0) {