diff --git a/spitfire/build.go b/spitfire/build.go index 41d1da5..f2a0825 100644 --- a/spitfire/build.go +++ b/spitfire/build.go @@ -82,8 +82,10 @@ func DiscardChanges(sourcePath string) { func CleanBuild(sourcePath string, fullClean bool) { fmt.Println("Cleaning build...") - if err := os.Chdir(sourcePath); err != nil { - errors = append(errors, "Failed to navigate to source directory.") + // Resolve the build directory dynamically + buildDir, err := ResolveBuildDir(sourcePath) + if err != nil { + errors = append(errors, fmt.Sprintf("Failed to resolve build directory: %v", err)) return } @@ -93,8 +95,8 @@ func CleanBuild(sourcePath string, fullClean bool) { } // Paths for CLOBBER file and last build timestamp - clobberFile := filepath.Join(sourcePath, "obj-x86_64-pc-windows-msvc", "CLOBBER") - buildTimestampFile := filepath.Join(sourcePath, "obj-x86_64-pc-windows-msvc", ".last_build_timestamp") + clobberFile := filepath.Join(buildDir, "CLOBBER") + buildTimestampFile := filepath.Join(buildDir, ".last_build_timestamp") // Check if a clobber is required clobberRequired := false