mirror of https://github.com/vitalif/grive2
Reduce syscalls slightly more (os::FileCTime is still left...)
parent
5bc503279a
commit
770baca3fc
|
@ -271,7 +271,7 @@ void Resource::FromLocal( const DateTime& last_sync )
|
|||
m_state = ( m_mtime > last_sync ? local_new : remote_deleted ) ;
|
||||
|
||||
m_name = path.filename().string() ;
|
||||
//m_kind = fs::is_directory(path) ? "folder" : "file" ;
|
||||
m_kind = IsFolder() ? "folder" : "file" ;
|
||||
m_md5 = IsFolder() ? "" : crypt::MD5::Get( path ) ;
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ void Resource::Sync( http::Agent *http, DateTime& sync_time, const Val& options
|
|||
void Resource::SyncSelf( http::Agent* http, const Val& options )
|
||||
{
|
||||
assert( !IsRoot() || m_state == sync ) ; // root is always sync
|
||||
assert( IsRoot() || http == 0 || fs::is_directory( m_parent->Path() ) ) ;
|
||||
assert( IsRoot() || http == 0 || m_parent->IsFolder() ) ;
|
||||
assert( IsRoot() || m_parent->m_state != remote_deleted ) ;
|
||||
assert( IsRoot() || m_parent->m_state != local_deleted ) ;
|
||||
|
||||
|
|
|
@ -76,21 +76,22 @@ void State::FromLocal( const fs::path& p, Resource* folder )
|
|||
for ( fs::directory_iterator i( p ) ; i != fs::directory_iterator() ; ++i )
|
||||
{
|
||||
std::string fname = i->path().filename().string() ;
|
||||
fs::file_status st = fs::status(i->path());
|
||||
|
||||
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 );
|
||||
Log( "%1% %2% is ignored", st.type() == fs::directory_file ? "folder" : "file", fname, log::verbose );
|
||||
|
||||
// check for broken symblic links
|
||||
else if ( !fs::exists( i->path() ) )
|
||||
else if ( st.type() == fs::file_not_found )
|
||||
Log( "file %1% doesn't exist (broken link?), ignored", i->path(), log::verbose ) ;
|
||||
|
||||
else
|
||||
{
|
||||
bool is_dir = fs::is_directory(i->path());
|
||||
bool is_dir = st.type() == fs::directory_file;
|
||||
// if the Resource object of the child already exists, it should
|
||||
// have been so no need to do anything here
|
||||
Resource *c = folder->FindChild( fname ) ;
|
||||
|
@ -101,7 +102,7 @@ void State::FromLocal( const fs::path& p, Resource* folder )
|
|||
m_res.Insert( c ) ;
|
||||
}
|
||||
|
||||
c->FromLocal( m_last_sync ) ;
|
||||
c->FromLocal( m_last_sync ) ;
|
||||
|
||||
if ( is_dir )
|
||||
FromLocal( *i, c ) ;
|
||||
|
|
Loading…
Reference in New Issue