From 30b3f75fabea9932c3222e49d5999bce2256a8d5 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Thu, 8 Nov 2012 09:44:27 -0500 Subject: [PATCH] fix ssh generic paths --- include/fc/filesystem.hpp | 1 + src/filesystem.cpp | 3 +++ src/ssh.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/fc/filesystem.hpp b/include/fc/filesystem.hpp index 1c33a38..01c06a2 100644 --- a/include/fc/filesystem.hpp +++ b/include/fc/filesystem.hpp @@ -37,6 +37,7 @@ namespace fc { fc::path filename()const; fc::path parent_path()const; fc::string string()const; + fc::string generic_string()const; private: fwd _p; }; diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 385dfaf..10236b8 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -49,6 +49,9 @@ namespace fc { path::operator const boost::filesystem::path& ()const { return *_p; } + fc::string path::generic_string()const { + return _p->generic_string(); + } fc::string path::string()const { return _p->string().c_str(); diff --git a/src/ssh.cpp b/src/ssh.cpp index d59bed9..293957c 100644 --- a/src/ssh.cpp +++ b/src/ssh.cpp @@ -426,13 +426,13 @@ namespace fc { namespace ssh { time_t now; memset( &now, 0, sizeof(now) ); // TODO: preserve creation / modification date - chan = libssh2_scp_send64( my->session, remote_path.string().c_str(), 0700, fsize, now, now ); + chan = libssh2_scp_send64( my->session, remote_path.generic_string().c_str(), 0700, fsize, now, now ); while( chan == 0 ) { char* msg; int ec = libssh2_session_last_error( my->session, &msg, 0, 0 ); if( ec == LIBSSH2_ERROR_EAGAIN ) { my->wait_on_socket(); - chan = libssh2_scp_send64( my->session, local_path.string().c_str(), 0700, fsize, now, now ); + chan = libssh2_scp_send64( my->session, local_path.generic_string().c_str(), 0700, fsize, now, now ); } else { FC_THROW_MSG( "scp %s to %s failed %s - %s",local_path.string(), remote_path.string(), ec, msg ); } @@ -486,10 +486,10 @@ namespace fc { namespace ssh { return; // nothing to do } - int rc = libssh2_sftp_unlink(my->sftp, remote_path.string().c_str() ); + int rc = libssh2_sftp_unlink(my->sftp, remote_path.generic_string().c_str() ); while( rc == LIBSSH2_ERROR_EAGAIN ) { my->wait_on_socket(); - rc = libssh2_sftp_unlink(my->sftp, remote_path.string().c_str() ); + rc = libssh2_sftp_unlink(my->sftp, remote_path.generic_string().c_str() ); } if( 0 != rc ) { rc = libssh2_sftp_last_error(my->sftp); @@ -500,10 +500,10 @@ namespace fc { namespace ssh { file_attrib client::stat( const fc::path& remote_path ){ my->init_sftp(); LIBSSH2_SFTP_ATTRIBUTES att; - int ec = libssh2_sftp_stat( my->sftp, remote_path.string().c_str(), &att ); + int ec = libssh2_sftp_stat( my->sftp, remote_path.generic_string().c_str(), &att ); while( ec == LIBSSH2_ERROR_EAGAIN ) { my->wait_on_socket(); - ec = libssh2_sftp_stat( my->sftp, remote_path.string().c_str(), &att ); + ec = libssh2_sftp_stat( my->sftp, remote_path.generic_string().c_str(), &att ); } if( ec ) { return file_attrib();