From: Carl Hetherington Date: Mon, 18 Apr 2016 21:15:10 +0000 (+0100) Subject: Use generic_string() in a couple of places to avoid unwanted backslashes in filenames. X-Git-Tag: v2.7.14~2 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f71c67d250140c16aaf6d127f86645919435753f Use generic_string() in a couple of places to avoid unwanted backslashes in filenames. --- diff --git a/ChangeLog b/ChangeLog index 3ff75fc8d..a4d7ccc5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-04-18 Carl Hetherington + + * Possibly fix strange paths when uploading DCPs using + FTP/SCP. + 2016-04-17 Carl Hetherington * Updated nl_NL translation from Rob van Nieuwkerk. 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) {