From 9fa57a209b198fa91bf1786b2dfb665cac2a7b23 Mon Sep 17 00:00:00 2001 From: tDwtp Date: Wed, 17 Jun 2020 17:01:05 +0200 Subject: [PATCH] languages sub directory langauges no longer clutter the plugin directory `langauge/init.lua` will load all languages as the plugins loader does. (literally copy pasted, but fenced to avoid a "require overflow") --- data/plugins/{language_c.lua => language/c.lua} | 0 .../{language_css.lua => language/css.lua} | 0 data/plugins/language/init.lua | 16 ++++++++++++++++ .../plugins/{language_js.lua => language/js.lua} | 0 .../{language_lua.lua => language/lua.lua} | 0 .../plugins/{language_md.lua => language/md.lua} | 0 .../{language_python.lua => language/python.lua} | 0 .../{language_xml.lua => language/xml.lua} | 0 8 files changed, 16 insertions(+) rename data/plugins/{language_c.lua => language/c.lua} (100%) rename data/plugins/{language_css.lua => language/css.lua} (100%) create mode 100644 data/plugins/language/init.lua rename data/plugins/{language_js.lua => language/js.lua} (100%) rename data/plugins/{language_lua.lua => language/lua.lua} (100%) rename data/plugins/{language_md.lua => language/md.lua} (100%) rename data/plugins/{language_python.lua => language/python.lua} (100%) rename data/plugins/{language_xml.lua => language/xml.lua} (100%) diff --git a/data/plugins/language_c.lua b/data/plugins/language/c.lua similarity index 100% rename from data/plugins/language_c.lua rename to data/plugins/language/c.lua diff --git a/data/plugins/language_css.lua b/data/plugins/language/css.lua similarity index 100% rename from data/plugins/language_css.lua rename to data/plugins/language/css.lua diff --git a/data/plugins/language/init.lua b/data/plugins/language/init.lua new file mode 100644 index 0000000..faf2acb --- /dev/null +++ b/data/plugins/language/init.lua @@ -0,0 +1,16 @@ +local core = require "core" + +local no_errors = true +local files = system.list_dir(EXEDIR .. "/data/plugins/language") +for _, filename in ipairs(files) do + local langname = filename:gsub(".lua$", "") + if langname ~= "init" then + local ok = core.try(require, "plugins.language." .. langname) + if ok then + core.log_quiet("Loaded language %q", langname) + else + no_errors = false + end + end +end +return no_errors diff --git a/data/plugins/language_js.lua b/data/plugins/language/js.lua similarity index 100% rename from data/plugins/language_js.lua rename to data/plugins/language/js.lua diff --git a/data/plugins/language_lua.lua b/data/plugins/language/lua.lua similarity index 100% rename from data/plugins/language_lua.lua rename to data/plugins/language/lua.lua diff --git a/data/plugins/language_md.lua b/data/plugins/language/md.lua similarity index 100% rename from data/plugins/language_md.lua rename to data/plugins/language/md.lua diff --git a/data/plugins/language_python.lua b/data/plugins/language/python.lua similarity index 100% rename from data/plugins/language_python.lua rename to data/plugins/language/python.lua diff --git a/data/plugins/language_xml.lua b/data/plugins/language/xml.lua similarity index 100% rename from data/plugins/language_xml.lua rename to data/plugins/language/xml.lua