Commit 24904fb4 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

FsDiscoverer: Handle an entrypoint not being found upon reload

parent 3f5d3144
...@@ -125,7 +125,17 @@ void FsDiscoverer::reloadFolder( std::shared_ptr<Folder> f ) ...@@ -125,7 +125,17 @@ void FsDiscoverer::reloadFolder( std::shared_ptr<Folder> f )
{ {
LOG_INFO( "Failed to instanciate a directory for ", mrl, ": ", ex.what(), LOG_INFO( "Failed to instanciate a directory for ", mrl, ": ", ex.what(),
". Can't reload the folder." ); ". Can't reload the folder." );
return; }
if ( directory == nullptr )
{
auto device = m_fsFactory->createDeviceFromMrl( mrl );
if ( device == nullptr || device->isRemovable() == false )
{
LOG_INFO( "Failed to find folder matching entrypoint ", mrl, ". "
"Removing that folder" );
m_ml->deleteFolder( *f );
return;
}
} }
try try
{ {
......
...@@ -462,3 +462,15 @@ TEST_F( Folders, RemoveNonExistantEntryPoint ) ...@@ -462,3 +462,15 @@ TEST_F( Folders, RemoveNonExistantEntryPoint )
auto res = cbMock->waitEntryPointRemoved(); auto res = cbMock->waitEntryPointRemoved();
ASSERT_TRUE( res ); ASSERT_TRUE( res );
} }
TEST_F( Folders, RemoveRootFolder )
{
ASSERT_EQ( 3u, ml->files().size() );
// Do not watch for live changes
ml.reset();
fsMock->removeFolder( mock::FileSystemFactory::Root );
Reload();
ASSERT_EQ( 0u, ml->files().size() );
}
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