- files, _ := ioutil.ReadDir(configDir + "/plugins")
- for _, plugin := range files {
- if plugin.IsDir() {
- pluginName := plugin.Name()
- files, _ := ioutil.ReadDir(configDir + "/plugins/" + pluginName)
- for _, f := range files {
- if f.Name() == pluginName+".lua" {
- data, _ := ioutil.ReadFile(configDir + "/plugins/" + pluginName + "/" + f.Name())
- pluginDef := "\nlocal P = {}\n" + pluginName + " = P\nsetmetatable(" + pluginName + ", {__index = _G})\nsetfenv(1, P)\n"
-
- if err := L.DoString(pluginDef + string(data)); err != nil {
- TermMessage(err)
- continue
- }
- loadedPlugins = append(loadedPlugins, pluginName)
- }
- }
- }
- }
-
- for _, pluginName := range preInstalledPlugins {