8
8
"fmt"
9
9
"io"
10
10
"io/fs"
11
- "os"
12
11
"path"
13
12
"path/filepath"
14
13
"strconv"
@@ -19,6 +18,7 @@ import (
19
18
"github.com/getkin/kin-openapi/openapi2"
20
19
"github.com/getkin/kin-openapi/openapi2conv"
21
20
"github.com/getkin/kin-openapi/openapi3"
21
+ "github.com/gptscript-ai/gptscript/internal"
22
22
"github.com/gptscript-ai/gptscript/pkg/assemble"
23
23
"github.com/gptscript-ai/gptscript/pkg/builtin"
24
24
"github.com/gptscript-ai/gptscript/pkg/cache"
@@ -61,7 +61,7 @@ func (s *source) String() string {
61
61
}
62
62
63
63
func openFile (path string ) (io.ReadCloser , bool , error ) {
64
- f , err := os .Open (path )
64
+ f , err := internal . FS .Open (path )
65
65
if errors .Is (err , fs .ErrNotExist ) {
66
66
return nil , false , nil
67
67
} else if err != nil {
@@ -74,10 +74,10 @@ func loadLocal(base *source, name string) (*source, bool, error) {
74
74
// We want to keep all strings in / format, and only convert to platform specific when reading
75
75
filePath := path .Join (base .Path , name )
76
76
77
- if s , err := os .Stat (filepath .Clean (filePath )); err == nil && s .IsDir () {
77
+ if s , err := fs .Stat (internal . FS , filepath .Clean (filePath )); err == nil && s .IsDir () {
78
78
for _ , def := range types .DefaultFiles {
79
79
toolPath := path .Join (filePath , def )
80
- if s , err := os .Stat (filepath .Clean (toolPath )); err == nil && ! s .IsDir () {
80
+ if s , err := fs .Stat (internal . FS , filepath .Clean (toolPath )); err == nil && ! s .IsDir () {
81
81
filePath = toolPath
82
82
break
83
83
}
0 commit comments