Builder/spitfire/resolvebuilddir.go
2024-12-11 16:45:34 +01:00

25 lines
662 B
Go

package spitfire
import (
"fmt"
"path/filepath"
)
// ResolveBuildDir detects the build directory dynamically
func ResolveBuildDir(sourcePath string) (string, error) {
// The expected build directory pattern
globPattern := filepath.Join(sourcePath, "obj-*")
// Find matching directories
matches, err := filepath.Glob(globPattern)
if err != nil {
return "", fmt.Errorf("error resolving build directory: %v", err)
}
if len(matches) == 0 {
return "", fmt.Errorf("build directory not found under %s", sourcePath)
}
full := filepath.Join(matches[0], "dist", "bin")
// Return the first match (assumes one build directory exists)
return full, nil
}