Compiler defaults to .o when output name isn't specified

This commit is contained in:
Sasha Koshka 2024-03-28 18:16:58 -04:00
parent 15e418d8c1
commit 00110039e2
1 changed files with 9 additions and 5 deletions

View File

@ -34,12 +34,16 @@ func (this *Compiler) CompileUnit (address entity.Address) error {
// if the format isn't specified, try to get it from the filename
// extension of the input. if that isn't specified, default to .o
if this.Filetype == FiletypeUnknown {
var ok bool
this.Filetype, ok = FiletypeFromExt (
*this.Target,
filepath.Ext(this.Output))
if !ok {
if this.Output == "" {
this.Filetype = FiletypeObject
} else {
var ok bool
this.Filetype, ok = FiletypeFromExt (
*this.Target,
filepath.Ext(this.Output))
if !ok {
this.Filetype = FiletypeObject
}
}
}