File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -401,8 +401,19 @@ void PythonEnvironment::addPythonModulePathsFromPlugin(const std::string& plugin
401401 Plugin p = elem.second ;
402402 if ( p.getModuleName () == pluginName )
403403 {
404- std::string pluginLibraryPath = elem.first ;
404+ // 1. Try to find the plugin directory starting from SOFA root
405+ for ( auto path : sofa::helper::system::PluginRepository.getPaths () )
406+ {
407+ std::string pluginRoot = FileSystem::cleanPath ( path + " /" + pluginName );
408+ if ( FileSystem::exists (pluginRoot) && FileSystem::isDirectory (pluginRoot) )
409+ {
410+ addPythonModulePathsFromDirectory (pluginRoot);
411+ return ;
412+ }
413+ }
405414
415+ // 2. Try to find the plugin directory starting from the plugin library
416+ std::string pluginLibraryPath = elem.first ;
406417 // moduleRoot can be 1 or 2 levels above the library directory
407418 // like "plugin_name/lib/plugin_name.so"
408419 // or "sofa_root/bin/Release/plugin_name.dll"
@@ -413,7 +424,6 @@ void PythonEnvironment::addPythonModulePathsFromPlugin(const std::string& plugin
413424 moduleRoot = FileSystem::getParentDirectory (moduleRoot);
414425 maxDepth++;
415426 }
416-
417427 addPythonModulePathsFromDirectory (moduleRoot);
418428 return ;
419429 }
You can’t perform that action at this time.
0 commit comments