fix ssh generic paths
This commit is contained in:
parent
98f4b7026d
commit
30b3f75fab
3 changed files with 10 additions and 6 deletions
|
|
@ -37,6 +37,7 @@ namespace fc {
|
||||||
fc::path filename()const;
|
fc::path filename()const;
|
||||||
fc::path parent_path()const;
|
fc::path parent_path()const;
|
||||||
fc::string string()const;
|
fc::string string()const;
|
||||||
|
fc::string generic_string()const;
|
||||||
private:
|
private:
|
||||||
fwd<boost::filesystem::path,8> _p;
|
fwd<boost::filesystem::path,8> _p;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ namespace fc {
|
||||||
path::operator const boost::filesystem::path& ()const {
|
path::operator const boost::filesystem::path& ()const {
|
||||||
return *_p;
|
return *_p;
|
||||||
}
|
}
|
||||||
|
fc::string path::generic_string()const {
|
||||||
|
return _p->generic_string();
|
||||||
|
}
|
||||||
|
|
||||||
fc::string path::string()const {
|
fc::string path::string()const {
|
||||||
return _p->string().c_str();
|
return _p->string().c_str();
|
||||||
|
|
|
||||||
12
src/ssh.cpp
12
src/ssh.cpp
|
|
@ -426,13 +426,13 @@ namespace fc { namespace ssh {
|
||||||
time_t now;
|
time_t now;
|
||||||
memset( &now, 0, sizeof(now) );
|
memset( &now, 0, sizeof(now) );
|
||||||
// TODO: preserve creation / modification date
|
// 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 ) {
|
while( chan == 0 ) {
|
||||||
char* msg;
|
char* msg;
|
||||||
int ec = libssh2_session_last_error( my->session, &msg, 0, 0 );
|
int ec = libssh2_session_last_error( my->session, &msg, 0, 0 );
|
||||||
if( ec == LIBSSH2_ERROR_EAGAIN ) {
|
if( ec == LIBSSH2_ERROR_EAGAIN ) {
|
||||||
my->wait_on_socket();
|
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 {
|
} else {
|
||||||
FC_THROW_MSG( "scp %s to %s failed %s - %s",local_path.string(), remote_path.string(), ec, msg );
|
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
|
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 ) {
|
while( rc == LIBSSH2_ERROR_EAGAIN ) {
|
||||||
my->wait_on_socket();
|
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 ) {
|
if( 0 != rc ) {
|
||||||
rc = libssh2_sftp_last_error(my->sftp);
|
rc = libssh2_sftp_last_error(my->sftp);
|
||||||
|
|
@ -500,10 +500,10 @@ namespace fc { namespace ssh {
|
||||||
file_attrib client::stat( const fc::path& remote_path ){
|
file_attrib client::stat( const fc::path& remote_path ){
|
||||||
my->init_sftp();
|
my->init_sftp();
|
||||||
LIBSSH2_SFTP_ATTRIBUTES att;
|
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 ) {
|
while( ec == LIBSSH2_ERROR_EAGAIN ) {
|
||||||
my->wait_on_socket();
|
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 ) {
|
if( ec ) {
|
||||||
return file_attrib();
|
return file_attrib();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue