mirror of https://github.com/vitalif/grive2
refactored code in Update() to DetectChanges()
parent
62238c5ba6
commit
1d1365ea1a
|
@ -173,6 +173,7 @@ int Main( int argc, char **argv )
|
||||||
|
|
||||||
OAuth2 token( refresh_token, client_id, client_secret ) ;
|
OAuth2 token( refresh_token, client_id, client_secret ) ;
|
||||||
Drive drive( token, options ) ;
|
Drive drive( token, options ) ;
|
||||||
|
drive.DetectChanges() ;
|
||||||
|
|
||||||
if ( vm.count( "dry-run" ) == 0 )
|
if ( vm.count( "dry-run" ) == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,6 @@ Drive::Drive( OAuth2& auth, const Json& options ) :
|
||||||
{
|
{
|
||||||
m_http_hdr.Add( "Authorization: Bearer " + m_auth.AccessToken() ) ;
|
m_http_hdr.Add( "Authorization: Bearer " + m_auth.AccessToken() ) ;
|
||||||
m_http_hdr.Add( "GData-Version: 3.0" ) ;
|
m_http_hdr.Add( "GData-Version: 3.0" ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drive::FromRemote( const Entry& entry )
|
void Drive::FromRemote( const Entry& entry )
|
||||||
|
@ -129,7 +128,7 @@ void Drive::SyncFolders( http::Agent *http )
|
||||||
m_state.ResolveEntry() ;
|
m_state.ResolveEntry() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drive::Update()
|
void Drive::DetectChanges()
|
||||||
{
|
{
|
||||||
Log( "Reading local directories", log::info ) ;
|
Log( "Reading local directories", log::info ) ;
|
||||||
m_state.FromLocal( "." ) ;
|
m_state.FromLocal( "." ) ;
|
||||||
|
@ -172,9 +171,12 @@ void Drive::Update()
|
||||||
std::for_each( changes.begin(), changes.end(), boost::bind( &Drive::FromChange, this, _1 ) ) ;
|
std::for_each( changes.begin(), changes.end(), boost::bind( &Drive::FromChange, this, _1 ) ) ;
|
||||||
}
|
}
|
||||||
Log( "Synchronizing files", log::info ) ;
|
Log( "Synchronizing files", log::info ) ;
|
||||||
|
}
|
||||||
http::CurlAgent http2 ;
|
|
||||||
m_state.Sync( &http2, m_http_hdr ) ;
|
void Drive::Update()
|
||||||
|
{
|
||||||
|
http::CurlAgent http ;
|
||||||
|
m_state.Sync( &http, m_http_hdr ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drive::DryRun()
|
void Drive::DryRun()
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Drive
|
||||||
public :
|
public :
|
||||||
Drive( OAuth2& auth, const Json& options ) ;
|
Drive( OAuth2& auth, const Json& options ) ;
|
||||||
|
|
||||||
|
void DetectChanges() ;
|
||||||
void Update() ;
|
void Update() ;
|
||||||
void DryRun() ;
|
void DryRun() ;
|
||||||
void SaveState() ;
|
void SaveState() ;
|
||||||
|
|
Loading…
Reference in New Issue