This repository was archived by the owner on Jun 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,7 +83,12 @@ Python::Interpreter::Interpreter(){
8383 boost::filesystem::directory_iterator end_it;
8484 for (boost::filesystem::directory_iterator it (plugin_path);it!=end_it;it++){
8585 auto module_name=it->path ().stem ().string ();
86- if (module_name!=" __pycache__" ){
86+ if (module_name.empty ())
87+ break ;
88+ auto is_directory=boost::filesystem::is_directory (it->path ());
89+ auto has_py_extension=it->path ().extension ()==" .py" ;
90+ auto is_pycache=module_name==" __pycache__" ;
91+ if ((is_directory && !is_pycache)||has_py_extension){
8792 auto module =import (module_name);
8893 if (!module ){
8994 auto msg=" Error loading plugin `" +module_name+" `:\n " ;
Original file line number Diff line number Diff line change @@ -252,24 +252,25 @@ void Window::set_menu_actions() {
252252 notebook.configure (c);
253253 }
254254 }
255- while (file_path.has_parent_path ()){
256- auto parent=file_path.parent_path ();
257- if (parent==Config::get ().python .plugin_directory ){
258- auto stem=file_path.stem ().string ();
259- auto module =Python::get_loaded_module (stem);
260- module =module ? Python::reload (module ) : Python::import (stem);
261- if (module )
262- Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
263- else {
264- if (Python::thrown_exception_matches (PyExc_SyntaxError))
265- Terminal::get ().print (Python::SyntaxError ());
266- else
267- Terminal::get ().print (Python::Error ());
255+ if (file_path.extension ().string ()==" .py" )
256+ while (file_path.has_parent_path ()){
257+ auto parent=file_path.parent_path ();
258+ if (parent==Config::get ().python .plugin_directory ){
259+ auto stem=file_path.stem ().string ();
260+ auto module =Python::get_loaded_module (stem);
261+ module =module ? Python::reload (module ) : Python::import (stem);
262+ if (module )
263+ Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
264+ else {
265+ if (Python::thrown_exception_matches (PyExc_SyntaxError))
266+ Terminal::get ().print (Python::SyntaxError ());
267+ else
268+ Terminal::get ().print (Python::Error ());
269+ }
270+ break ;
268271 }
269- break ;
272+ file_path=parent ;
270273 }
271- file_path=parent;
272- }
273274 }
274275 }
275276 }
You can’t perform that action at this time.
0 commit comments