diff --git a/libs/ardour/ardour/luascripting.h b/libs/ardour/ardour/luascripting.h index 7570ff1bc8..6b99ac1c61 100644 --- a/libs/ardour/ardour/luascripting.h +++ b/libs/ardour/ardour/luascripting.h @@ -123,6 +123,10 @@ public: static std::string get_factory_bytecode (const std::string&, const std::string& ffn = "factory", const std::string& fp = "f"); static std::string user_script_dir (); + struct Sorter { + bool operator() (LuaScriptInfoPtr const a, LuaScriptInfoPtr const b) const; + }; + private: static LuaScripting* _instance; // singleton LuaScripting (); diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index e748fb656e..2d56a608ea 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -28,6 +28,7 @@ #include "ardour/luascripting.h" #include "ardour/lua_script_params.h" #include "ardour/search_paths.h" +#include "ardour/utils.h" #include "lua/luastate.h" #include "LuaBridge/LuaBridge.h" @@ -104,11 +105,10 @@ LuaScripting::refresh (bool run_scan) } } -struct ScriptSorter { - bool operator () (LuaScriptInfoPtr a, LuaScriptInfoPtr b) { - return a->name < b->name; - } -}; +bool +LuaScripting::Sorter::operator() (LuaScriptInfoPtr const a, LuaScriptInfoPtr const b) const { + return ARDOUR::cmp_nocase_utf8 (a->name, b->name) < 0; +} LuaScriptInfoPtr LuaScripting::script_info (const std::string &script) { @@ -166,13 +166,13 @@ LuaScripting::scan () } } - std::sort (_sl_dsp->begin(), _sl_dsp->end(), ScriptSorter()); - std::sort (_sl_session->begin(), _sl_session->end(), ScriptSorter()); - std::sort (_sl_hook->begin(), _sl_hook->end(), ScriptSorter()); - std::sort (_sl_action->begin(), _sl_action->end(), ScriptSorter()); - std::sort (_sl_snippet->begin(), _sl_snippet->end(), ScriptSorter()); - std::sort (_sl_setup->begin(), _sl_setup->end(), ScriptSorter()); - std::sort (_sl_tracks->begin(), _sl_tracks->end(), ScriptSorter()); + std::sort (_sl_dsp->begin(), _sl_dsp->end(), Sorter()); + std::sort (_sl_session->begin(), _sl_session->end(), Sorter()); + std::sort (_sl_hook->begin(), _sl_hook->end(), Sorter()); + std::sort (_sl_action->begin(), _sl_action->end(), Sorter()); + std::sort (_sl_snippet->begin(), _sl_snippet->end(), Sorter()); + std::sort (_sl_setup->begin(), _sl_setup->end(), Sorter()); + std::sort (_sl_tracks->begin(), _sl_tracks->end(), Sorter()); scripts_changed (); /* EMIT SIGNAL */ }