From 88e76b367c347fb8ab8b0b83f894c0a650a14aa1 Mon Sep 17 00:00:00 2001 From: Daniel Lee Harple Date: Sun, 24 Jul 2022 17:13:46 -0400 Subject: [PATCH] plugins: load directories that are symlinks (#2214) Fix issue where symlinked plugin directories were ignored. For example $ file ~/.config/micro/plug/example example: symbolic link to This allows plugins to be managed in a user's "dotfiles" repository, and be symlinked into micro's plugin directory. --- internal/config/rtfiles.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/config/rtfiles.go b/internal/config/rtfiles.go index 397a8539..fb4497e6 100644 --- a/internal/config/rtfiles.go +++ b/internal/config/rtfiles.go @@ -186,8 +186,9 @@ func InitRuntimeFiles() { isID := regexp.MustCompile(`^[_A-Za-z0-9]+$`).MatchString for _, d := range files { - if d.IsDir() { - srcs, _ := ioutil.ReadDir(filepath.Join(plugdir, d.Name())) + plugpath := filepath.Join(plugdir, d.Name()) + if stat, err := os.Stat(plugpath); err == nil && stat.IsDir() { + srcs, _ := ioutil.ReadDir(plugpath) p := new(Plugin) p.Name = d.Name() p.DirName = d.Name() -- 2.44.0