Skip to content

Commit a50eb18

Browse files
chore: if loading a dir load ./tool.gpt
1 parent 8dda5ad commit a50eb18

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/loader/loader.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ func openFile(path string) (io.ReadCloser, bool, error) {
6464
func loadLocal(base *source, name string) (*source, bool, error) {
6565
path := filepath.Join(base.Path, name)
6666

67+
if s, err := os.Stat(path); err == nil && s.IsDir() {
68+
toolPath := filepath.Join(base.Path, name, "tool.gpt")
69+
if s, err := os.Stat(toolPath); err == nil && !s.IsDir() {
70+
path = toolPath
71+
}
72+
}
73+
6774
content, ok, err := openFile(path)
6875
if err != nil {
6976
return nil, false, err

0 commit comments

Comments
 (0)