Skip to content

Commit

Permalink
test existence of directory before browsing
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Dec 16, 2024
1 parent 7c52860 commit efb1016
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Sofa/framework/Helper/src/sofa/helper/system/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,16 @@ std::string PluginManager::findPlugin(const std::string& pluginName, const std::

for (const auto & path : paths)
{
for (auto const& dirEntry : std::filesystem::directory_iterator{path})
if ( fs::exists(path) )
{
const std::string filename = dirEntry.path().filename().string();
const std::string downcaseFilename = helper::downcaseString(filename);
if (downcaseFilename == downcaseLibName)
for (auto const& dirEntry : std::filesystem::directory_iterator{path})
{
return FileSystem::cleanPath(dirEntry.path().string());
const std::string filename = dirEntry.path().filename().string();
const std::string downcaseFilename = helper::downcaseString(filename);
if (downcaseFilename == downcaseLibName)
{
return FileSystem::cleanPath(dirEntry.path().string());
}
}
}
}
Expand Down

0 comments on commit efb1016

Please sign in to comment.