mirror of https://github.com/vitalif/grive2
Allow to sync just one directory in the root
parent
27817e835f
commit
752eb3fdda
|
@ -110,6 +110,7 @@ int Main( int argc, char **argv )
|
|||
( "version,v", "Display Grive version" )
|
||||
( "auth,a", "Request authorization token" )
|
||||
( "path,p", po::value<std::string>(), "Path to sync")
|
||||
( "dir,s", po::value<std::string>(), "Subdirectory to sync")
|
||||
( "verbose,V", "Verbose mode. Enable more messages than normal.")
|
||||
( "log-xml", "Log more HTTP responses as XML for debugging.")
|
||||
( "new-rev", "Create new revisions in server for updated files.")
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace gr { namespace v1 {
|
|||
|
||||
State::State( const fs::path& filename, const Json& options ) :
|
||||
m_res ( options["path"].Str() ),
|
||||
m_dir ( options["dir"].Str() ),
|
||||
m_cstamp ( -1 )
|
||||
{
|
||||
Read( filename ) ;
|
||||
|
@ -78,6 +79,10 @@ void State::FromLocal( const fs::path& p, Resource* folder )
|
|||
if ( IsIgnore(fname) )
|
||||
Log( "file %1% is ignored by grive", fname, log::verbose ) ;
|
||||
|
||||
// check if it is ignored
|
||||
else if ( folder == m_res.Root() && m_dir != "" && fname != m_dir )
|
||||
Log( "%1% %2% is ignored", fs::is_directory(i->path()) ? "folder" : "file", fname, log::verbose );
|
||||
|
||||
// check for broken symblic links
|
||||
else if ( !fs::exists( i->path() ) )
|
||||
Log( "file %1% doesn't exist (broken link?), ignored", i->path(), log::verbose ) ;
|
||||
|
@ -109,6 +114,10 @@ void State::FromRemote( const Entry& e )
|
|||
if ( IsIgnore( e.Name() ) )
|
||||
Log( "%1% %2% is ignored by grive", e.Kind(), e.Name(), log::verbose ) ;
|
||||
|
||||
// check if it is ignored
|
||||
else if ( e.ParentHref() == m_res.Root()->SelfHref() && m_dir != "" && e.Name() != m_dir )
|
||||
Log( "%1% %2% is ignored", e.Kind(), e.Name(), log::verbose );
|
||||
|
||||
// common checkings
|
||||
else if ( e.Kind() != "folder" && (fn.empty() || e.ContentSrc().empty()) )
|
||||
Log( "%1% \"%2%\" is a google document, ignored", e.Kind(), e.Name(), log::verbose ) ;
|
||||
|
|
|
@ -79,6 +79,7 @@ private :
|
|||
ResourceTree m_res ;
|
||||
DateTime m_last_sync ;
|
||||
long m_cstamp ;
|
||||
std::string m_dir ;
|
||||
|
||||
std::vector<Entry> m_unresolved ;
|
||||
} ;
|
||||
|
|
|
@ -42,6 +42,9 @@ Config::Config( const po::variables_map& vm )
|
|||
m_cmd.Add( "path", Json(vm.count("path") > 0
|
||||
? vm["path"].as<std::string>()
|
||||
: default_root_folder ) ) ;
|
||||
m_cmd.Add( "dir", Json(vm.count("dir") > 0
|
||||
? vm["dir"].as<std::string>()
|
||||
: "" ) ) ;
|
||||
|
||||
m_path = GetPath( fs::path(m_cmd["path"].Str()) ) ;
|
||||
m_file = Read( ) ;
|
||||
|
|
Loading…
Reference in New Issue