Commit 26ae94f6 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

FsDiscover: Check if the folder exists before checking if we know about it

Also, always use the folder path from the fs::IFolder instance rather
than the user provided path
parent fa882e4c
......@@ -48,18 +48,16 @@ bool FsDiscoverer::discover( const std::string &entryPoint )
return false;
std::shared_ptr<fs::IDirectory> fsDir = m_fsFactory->createDirectory( entryPoint );
{
auto f = Folder::fromPath( m_dbConn, entryPoint );
// If the folder exists, we assume it will be handled by reload()
if ( f != nullptr )
return true;
}
// Otherwise, create a directory and check it for modifications
if ( fsDir == nullptr )
{
LOG_ERROR("Failed to create an IDirectory for ", entryPoint );
return false;
}
auto f = Folder::fromPath( m_dbConn, fsDir->path() );
// If the folder exists, we assume it will be handled by reload()
if ( f != nullptr )
return true;
auto blist = blacklist();
if ( isBlacklisted( *fsDir, blist ) == true )
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment