Assembler file is in the current dir not in temp

This commit is contained in:
Mattias Hansson 2026-05-14 21:50:30 +02:00
parent 411106ea36
commit b095f78448

12
main.go
View file

@ -298,9 +298,9 @@ func build(inputFile, outputFile string, keepAsm, noCBM bool) error {
return err
}
// Create temporary assembly file
tempDir := os.TempDir()
asmFile := filepath.Join(tempDir, "c65gm_"+filepath.Base(inputFile)+".asm")
// Assembly file sits in current directory for easy inspection
base := strings.TrimSuffix(filepath.Base(inputFile), filepath.Ext(inputFile))
asmFile := base + ".asm"
// Compile to assembly
if err := compileOnly(inputFile, asmFile); err != nil {
@ -312,9 +312,11 @@ func build(inputFile, outputFile string, keepAsm, noCBM bool) error {
return fmt.Errorf("assembly failed: %w", err)
}
// Clean up temporary assembly file unless requested to keep it
// Remove assembly file unless requested to keep it
if !keepAsm {
os.Remove(asmFile)
if err := os.Remove(asmFile); err != nil {
return fmt.Errorf("failed to remove assembly file: %w", err)
}
} else {
fmt.Printf("Intermediate assembly file kept: %s\n", asmFile)
}