diff --git a/grive/src/main.cc b/grive/src/main.cc index 281245b..b31bc85 100644 --- a/grive/src/main.cc +++ b/grive/src/main.cc @@ -118,6 +118,8 @@ int Main( int argc, char **argv ) ( "log,l", po::value(), "Set log output filename." ) ( "force,f", "Force grive to always download a file from Google Drive " "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" ) ( "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, " diff --git a/libgrive/src/base/Resource.cc b/libgrive/src/base/Resource.cc index 9d359a6..da6580f 100644 --- a/libgrive/src/base/Resource.cc +++ b/libgrive/src/base/Resource.cc @@ -151,8 +151,16 @@ void Resource::FromRemoteFile( const Entry& remote ) 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 - 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 ) { 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 else if ( !remote.MD5().empty() && remote.MD5() == m_md5 ) { diff --git a/libgrive/src/util/Config.cc b/libgrive/src/util/Config.cc index ba0c91e..3c6bd88 100644 --- a/libgrive/src/util/Config.cc +++ b/libgrive/src/util/Config.cc @@ -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( "upload-only", Val( vm.count( "upload-only" ) > 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_file = Read( ) ;