Skip to content

Commit b424002

Browse files
committed
abs tsp-config.yaml path
1 parent 24c8b3f commit b424002

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

eng/tools/generator/cmd/v2/common/cmdProcessor.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,17 @@ func ExecuteTspClient(path string, args ...string) error {
147147
}
148148

149149
func ExecuteTypeSpecGenerate(ctx *GenerateContext, emitOptions string, tspClientOptions []string) error {
150+
tspConfigAbs, err := filepath.Abs(ctx.TypeSpecConfig.Path)
151+
if err != nil {
152+
return err
153+
}
154+
150155
args := []string{
151156
"init",
152-
"--tsp-config", ctx.TypeSpecConfig.Path,
157+
"--tsp-config", tspConfigAbs,
153158
"--commit", ctx.SpecCommitHash,
154159
"--repo", ctx.SpecRepoURL[len("https://github.com/"):],
155-
"--local-spec-repo", filepath.Dir(ctx.TypeSpecConfig.Path),
160+
"--local-spec-repo", filepath.Dir(tspConfigAbs),
156161
"--emitter-options", emitOptions,
157162
}
158163

eng/tools/generator/config/typespecRequests.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ type TypeSpecPakcageInfo struct {
3737

3838
func GetTypeSpecProjectsFromConfig(config *Config, specRoot string) (tspProjects map[string][]TypeSpecPakcageInfo, errResult error) {
3939
tspProjects = make(map[string][]TypeSpecPakcageInfo)
40+
specRootAbs, err := filepath.Abs(specRoot)
41+
if err != nil {
42+
return nil, err
43+
}
4044
for tspConfigPath, typespecRequests := range config.TypeSpecRequests {
4145
for _, releaseRequestInfo := range typespecRequests {
42-
localTspConfigPath := filepath.Join(specRoot, tspConfigPath)
46+
localTspConfigPath := filepath.Join(specRootAbs, tspConfigPath)
4347
tspConfig, err := typespec.ParseTypeSpecConfig(localTspConfigPath)
4448
if err != nil {
4549
return nil, err

0 commit comments

Comments
 (0)