fixed build directory check

This commit is contained in:
partisan 2024-12-29 08:54:45 +01:00
parent b876df0d83
commit e7faf3d641

21
main.go
View file

@ -183,12 +183,6 @@ func BuildProcess() {
log.Fatalf("Error resolving source path: %v", err)
}
// Detect the build directory dynamically
buildDir, err := spitfire.ResolveBuildDir(sourcePath)
if err != nil {
log.Fatalf("Error resolving build directory: %v", err)
}
if all {
spitfire.DownloadSource(sourcePath, sourceRepo)
spitfire.DiscardChanges(sourcePath)
@ -199,6 +193,11 @@ func BuildProcess() {
}
spitfire.Configure(sourcePath)
spitfire.Build(sourcePath)
// Detect the build directory dynamically
buildDir, err := spitfire.ResolveBuildDir(sourcePath)
if err != nil {
log.Fatalf("Error resolving build directory: %v", err)
}
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
log.Fatalf("Error during patch application: %v", err)
}
@ -214,6 +213,11 @@ func BuildProcess() {
}
spitfire.Configure(sourcePath)
spitfire.Build(sourcePath)
// Detect the build directory dynamically
buildDir, err := spitfire.ResolveBuildDir(sourcePath)
if err != nil {
log.Fatalf("Error resolving build directory: %v", err)
}
if postPatch {
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
log.Fatalf("Error during patch application: %v", err)
@ -237,6 +241,11 @@ func BuildProcess() {
}
fmt.Println("Patches updated.")
} else if postPatch {
// Detect the build directory dynamically
buildDir, err := spitfire.ResolveBuildDir(sourcePath)
if err != nil {
log.Fatalf("Error resolving build directory: %v", err)
}
if _, err := os.Stat(buildDir); err == nil {
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
log.Fatalf("Error during patch application: %v", err)