fix recursively add folder (#59)

pull/40/head
Nestal Wan 2012-06-14 01:42:41 +08:00
parent 5740d7b77f
commit ea4fda5b54
1 changed files with 8 additions and 2 deletions

View File

@ -235,11 +235,17 @@ void Resource::FromLocal( const DateTime& last_sync )
// root folder is always in sync // root folder is always in sync
if ( !IsRoot() ) if ( !IsRoot() )
{ {
m_mtime = os::FileCTime( path ) ;
// follow parent recursively
if ( m_parent->m_state == local_new || m_parent->m_state == local_deleted )
m_state = local_new ;
// if the file is not created after last sync, assume file is // if the file is not created after last sync, assume file is
// remote_deleted first, it will be updated to sync/remote_changed // remote_deleted first, it will be updated to sync/remote_changed
// in FromRemote() // in FromRemote()
m_mtime = os::FileCTime( path ) ; else
m_state = ( m_mtime > last_sync ? local_new : remote_deleted ) ; m_state = ( m_mtime > last_sync ? local_new : remote_deleted ) ;
m_name = path.filename().string() ; m_name = path.filename().string() ;
m_kind = fs::is_directory(path) ? "folder" : "file" ; m_kind = fs::is_directory(path) ? "folder" : "file" ;