Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit 1e9c589

Browse files
committed
bugfix: make sure to only load plugins within the plugin folder
1 parent 23a9f94 commit 1e9c589

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/window.cc

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,22 @@ void Window::set_menu_actions() {
252252
notebook.configure(c);
253253
}
254254
}
255-
if(file_path>Config::get().python.plugin_directory){
256-
auto stem=file_path.stem().string();
257-
auto module=Python::get_loaded_module(stem);
258-
module=module ? Python::reload(module) : Python::import(stem);
259-
if(module)
260-
Terminal::get().print("Plugin `"+stem+"` was reloaded\n");
261-
else {
262-
if(Python::thrown_exception_matches(Python::Error::Type::Syntax))
263-
Terminal::get().print(Python::SyntaxError());
264-
else
265-
Terminal::get().print(Python::Error());
255+
while(file_path.has_parent_path()){
256+
if(file_path == Config::get().python.plugin_directory){
257+
auto stem=file_path.stem().string();
258+
auto module=Python::get_loaded_module(stem);
259+
module=module ? Python::reload(module) : Python::import(stem);
260+
if(module)
261+
Terminal::get().print("Plugin `"+stem+"` was reloaded\n");
262+
else {
263+
if(Python::thrown_exception_matches(Python::Error::Type::Syntax))
264+
Terminal::get().print(Python::SyntaxError());
265+
else
266+
Terminal::get().print(Python::Error());
267+
}
268+
break;
266269
}
270+
file_path=file_path.parent_path();
267271
}
268272
}
269273
}

0 commit comments

Comments
 (0)