mirror of https://github.com/vitalif/grive2
fixed assertion if remote has dot file (#43)
parent
856914c4dc
commit
c81bb0aaec
|
@ -220,4 +220,9 @@ bool Entry::IsRemoved() const
|
||||||
return m_is_removed ;
|
return m_is_removed ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Entry::Name() const
|
||||||
|
{
|
||||||
|
return m_kind == "folder" ? m_title : m_filename ;
|
||||||
|
}
|
||||||
|
|
||||||
} // end of namespace
|
} // end of namespace
|
||||||
|
|
|
@ -64,6 +64,8 @@ public :
|
||||||
std::string ContentSrc() const ;
|
std::string ContentSrc() const ;
|
||||||
std::string EditLink() const ;
|
std::string EditLink() const ;
|
||||||
std::string CreateLink() const ;
|
std::string CreateLink() const ;
|
||||||
|
long ChangeStamp() const ;
|
||||||
|
bool IsRemoved() const ;
|
||||||
|
|
||||||
const std::vector<std::string>& ParentHrefs() const ;
|
const std::vector<std::string>& ParentHrefs() const ;
|
||||||
|
|
||||||
|
@ -72,9 +74,7 @@ public :
|
||||||
void Update( const xml::Node& entry ) ;
|
void Update( const xml::Node& entry ) ;
|
||||||
void Update( const std::string& md5, const DateTime& mtime ) ;
|
void Update( const std::string& md5, const DateTime& mtime ) ;
|
||||||
|
|
||||||
long ChangeStamp() const ;
|
std::string Name() const ;
|
||||||
|
|
||||||
bool IsRemoved() const ;
|
|
||||||
|
|
||||||
private :
|
private :
|
||||||
std::string m_title ;
|
std::string m_title ;
|
||||||
|
|
|
@ -228,7 +228,7 @@ std::string Resource::SelfHref() const
|
||||||
|
|
||||||
std::string Resource::Name() const
|
std::string Resource::Name() const
|
||||||
{
|
{
|
||||||
return IsFolder() ? m_entry.Title() : m_entry.Filename() ;
|
return m_entry.Name() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Resource::ResourceID() const
|
std::string Resource::ResourceID() const
|
||||||
|
|
|
@ -59,6 +59,11 @@ void State::FromLocal( const fs::path& p )
|
||||||
FromLocal( p, m_res.Root() ) ;
|
FromLocal( p, m_res.Root() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool State::IsIgnore( const std::string& filename )
|
||||||
|
{
|
||||||
|
return filename[0] == '.' ;
|
||||||
|
}
|
||||||
|
|
||||||
void State::FromLocal( const fs::path& p, gr::Resource* folder )
|
void State::FromLocal( const fs::path& p, gr::Resource* folder )
|
||||||
{
|
{
|
||||||
assert( folder != 0 ) ;
|
assert( folder != 0 ) ;
|
||||||
|
@ -71,7 +76,7 @@ void State::FromLocal( const fs::path& p, gr::Resource* folder )
|
||||||
{
|
{
|
||||||
std::string fname = i->path().filename().string() ;
|
std::string fname = i->path().filename().string() ;
|
||||||
|
|
||||||
if ( fname[0] == '.' )
|
if ( IsIgnore(fname) )
|
||||||
Log( "file %1% is ignored by grive", fname, log::verbose ) ;
|
Log( "file %1% is ignored by grive", fname, log::verbose ) ;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -96,7 +101,10 @@ void State::FromLocal( const fs::path& p, gr::Resource* folder )
|
||||||
|
|
||||||
void State::FromRemote( const Entry& e )
|
void State::FromRemote( const Entry& e )
|
||||||
{
|
{
|
||||||
if ( !Update( e ) )
|
if ( IsIgnore( e.Name() ) )
|
||||||
|
Log( "%1% %2% is ignored by grive", e.Kind(), e.Name(), log::verbose ) ;
|
||||||
|
|
||||||
|
else if ( !Update( e ) )
|
||||||
{
|
{
|
||||||
m_unresolved.push_back( e ) ;
|
m_unresolved.push_back( e ) ;
|
||||||
}
|
}
|
||||||
|
@ -133,9 +141,12 @@ std::size_t State::TryResolveEntry()
|
||||||
|
|
||||||
void State::FromChange( const Entry& e )
|
void State::FromChange( const Entry& e )
|
||||||
{
|
{
|
||||||
|
if ( IsIgnore( e.Name() ) )
|
||||||
|
Log( "%1% %2% is ignored by grive", e.Kind(), e.Name(), log::verbose ) ;
|
||||||
|
|
||||||
// entries in the change feed is always treated as newer in remote,
|
// entries in the change feed is always treated as newer in remote,
|
||||||
// so we override the last sync time to 0
|
// so we override the last sync time to 0
|
||||||
if ( Resource *res = m_res.FindByHref( e.AltSelf() ) )
|
else if ( Resource *res = m_res.FindByHref( e.AltSelf() ) )
|
||||||
m_res.Update( res, e, DateTime() ) ;
|
m_res.Update( res, e, DateTime() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ private :
|
||||||
bool Update( const Entry& e ) ;
|
bool Update( const Entry& e ) ;
|
||||||
std::size_t TryResolveEntry() ;
|
std::size_t TryResolveEntry() ;
|
||||||
|
|
||||||
|
static bool IsIgnore( const std::string& filename ) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
ResourceTree m_res ;
|
ResourceTree m_res ;
|
||||||
DateTime m_last_sync ;
|
DateTime m_last_sync ;
|
||||||
|
|
Loading…
Reference in New Issue