Skip to content

Commit 371de67

Browse files
committed
chore: make workspace path always absolute
Signed-off-by: Taylor Price <[email protected]>
1 parent 3b5d2e3 commit 371de67

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/gptscript/gptscript.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package gptscript
33
import (
44
"context"
55
"fmt"
6-
"os"
7-
86
"github.com/gptscript-ai/gptscript/pkg/builtin"
97
"github.com/gptscript-ai/gptscript/pkg/cache"
108
"github.com/gptscript-ai/gptscript/pkg/engine"
@@ -17,6 +15,8 @@ import (
1715
"github.com/gptscript-ai/gptscript/pkg/repos/runtimes"
1816
"github.com/gptscript-ai/gptscript/pkg/runner"
1917
"github.com/gptscript-ai/gptscript/pkg/types"
18+
"os"
19+
"path/filepath"
2020
)
2121

2222
var log = mvl.Package()
@@ -113,6 +113,12 @@ func (g *GPTScript) getEnv(env []string) ([]string, error) {
113113
if err != nil {
114114
return nil, err
115115
}
116+
} else if !filepath.IsAbs(g.WorkspacePath) {
117+
var err error
118+
g.WorkspacePath, err = filepath.Abs(g.WorkspacePath)
119+
if err != nil {
120+
return nil, err
121+
}
116122
}
117123
if err := os.MkdirAll(g.WorkspacePath, 0700); err != nil {
118124
return nil, err

0 commit comments

Comments
 (0)