mirror of https://github.com/vitalif/grive2
optional gdocs sync
parent
6670ae2d24
commit
9d7296c3c4
|
@ -118,6 +118,8 @@ int Main( int argc, char **argv )
|
||||||
( "log,l", po::value<std::string>(), "Set log output filename." )
|
( "log,l", po::value<std::string>(), "Set log output filename." )
|
||||||
( "force,f", "Force grive to always download a file from Google Drive "
|
( "force,f", "Force grive to always download a file from Google Drive "
|
||||||
"instead of uploading it." )
|
"instead of uploading it." )
|
||||||
|
( "gdocs,g", "Include Google Docs in sync (default is exclude)."
|
||||||
|
" Google Docs are downloaded in OXML formats." )
|
||||||
( "upload-only,u", "Do not download anything from Google Drive, only upload local changes" )
|
( "upload-only,u", "Do not download anything from Google Drive, only upload local changes" )
|
||||||
( "no-remote-new,n", "Download only files that are changed in Google Drive and already exist locally" )
|
( "no-remote-new,n", "Download only files that are changed in Google Drive and already exist locally" )
|
||||||
( "dry-run", "Only detect which files need to be uploaded/downloaded, "
|
( "dry-run", "Only detect which files need to be uploaded/downloaded, "
|
||||||
|
|
|
@ -151,8 +151,16 @@ void Resource::FromRemoteFile( const Entry& remote )
|
||||||
|
|
||||||
fs::path path = Path() ;
|
fs::path path = Path() ;
|
||||||
|
|
||||||
|
// remote download URL unknown, skip file
|
||||||
|
if ( remote.ContentSrc().empty() )
|
||||||
|
{
|
||||||
|
Log( "file %1% has unknown download URL. assumed in sync",
|
||||||
|
Path(), log::verbose ) ;
|
||||||
|
m_state = sync ;
|
||||||
|
}
|
||||||
|
|
||||||
// recursively create/delete folder
|
// recursively create/delete folder
|
||||||
if ( m_parent->m_state == remote_new || m_parent->m_state == remote_deleted ||
|
else if ( m_parent->m_state == remote_new || m_parent->m_state == remote_deleted ||
|
||||||
m_parent->m_state == local_new || m_parent->m_state == local_deleted )
|
m_parent->m_state == local_new || m_parent->m_state == local_deleted )
|
||||||
{
|
{
|
||||||
Log( "file %1% parent %2% recursively in %3% (%4%)", path,
|
Log( "file %1% parent %2% recursively in %3% (%4%)", path,
|
||||||
|
@ -185,14 +193,6 @@ void Resource::FromRemoteFile( const Entry& remote )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remote download URL unknown, skip file
|
|
||||||
else if ( remote.ContentSrc().empty() )
|
|
||||||
{
|
|
||||||
Log( "file %1% has unknown download URL. assumed in sync",
|
|
||||||
Path(), log::verbose ) ;
|
|
||||||
m_state = sync ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if checksum is equal, no need to compare the mtime
|
// if checksum is equal, no need to compare the mtime
|
||||||
else if ( !remote.MD5().empty() && remote.MD5() == m_md5 )
|
else if ( !remote.MD5().empty() && remote.MD5() == m_md5 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,8 @@ Config::Config( const po::variables_map& vm )
|
||||||
m_cmd.Add( "no-remote-new", Val( vm.count( "no-remote-new" ) > 0 || vm.count( "upload-only" ) > 0 ) );
|
m_cmd.Add( "no-remote-new", Val( vm.count( "no-remote-new" ) > 0 || vm.count( "upload-only" ) > 0 ) );
|
||||||
m_cmd.Add( "upload-only", Val( vm.count( "upload-only" ) > 0 ) );
|
m_cmd.Add( "upload-only", Val( vm.count( "upload-only" ) > 0 ) );
|
||||||
m_cmd.Add( "no-delete-remote", Val( vm.count( "no-delete-remote" ) > 0 ) );
|
m_cmd.Add( "no-delete-remote", Val( vm.count( "no-delete-remote" ) > 0 ) );
|
||||||
|
if ( vm.count( "gdocs" ) > 0 )
|
||||||
|
m_cmd.Add( "gdocs", Val( true ) );
|
||||||
|
|
||||||
m_path = GetPath( fs::path(m_cmd["path"].Str()) ) ;
|
m_path = GetPath( fs::path(m_cmd["path"].Str()) ) ;
|
||||||
m_file = Read( ) ;
|
m_file = Read( ) ;
|
||||||
|
|
Loading…
Reference in New Issue