From 469eb47068b1f99226238548e7d5ed7ece1b333b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 3 Oct 2017 17:32:37 +0200 Subject: [PATCH] More consistent definition of Ruby/Python path with less invalid components. --- src/lay/lay/layMacroController.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lay/lay/layMacroController.cc b/src/lay/lay/layMacroController.cc index 52f83c029..45321ee16 100644 --- a/src/lay/lay/layMacroController.cc +++ b/src/lay/lay/layMacroController.cc @@ -59,6 +59,8 @@ MacroController::load () lym::MacroCollection::root ().add_folder (tl::to_string (QObject::tr ("Built-In")), ":/built-in-pymacros", "pymacros", true); // TODO: consider adding "drc" dynamically and allow more dynamic categories + // We can do so if we first load the macros with the initial interpreters, then do autorun (which creates DSL interpreters) and then + // register the remaining categories. m_macro_categories.push_back (std::pair ("macros", tl::to_string (QObject::tr ("Ruby")))); m_macro_categories.push_back (std::pair ("pymacros", tl::to_string (QObject::tr ("Python")))); m_macro_categories.push_back (std::pair ("drc", tl::to_string (QObject::tr ("DRC")))); @@ -78,8 +80,12 @@ MacroController::load () } } - for (tl::Registrar::iterator i = gsi::interpreters.begin (); i != gsi::interpreters.end (); ++i) { - i->add_package_location (p->path); + // Add the unspecific paths as "package locations", so we get "ruby", "python" and similar folders as + // path components inside the interpreters. + if (p->cat.empty ()) { + for (tl::Registrar::iterator i = gsi::interpreters.begin (); i != gsi::interpreters.end (); ++i) { + i->add_package_location (p->path); + } } }