Improved Windows support

This commit is contained in:
2024-08-14 13:41:22 +02:00
parent 9d0077d1a4
commit 235188e457
3 changed files with 18 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import (
"strings"
"git.akyoto.dev/cli/q/src/compiler"
"git.akyoto.dev/cli/q/src/config"
"git.akyoto.dev/cli/q/src/scanner"
)
@ -31,10 +32,16 @@ func (build *Build) Executable() string {
path, _ := filepath.Abs(build.Files[0])
if strings.HasSuffix(path, ".q") {
return fromFileName(path)
path = fromFileName(path)
} else {
return fromDirectoryName(path)
path = fromDirectoryName(path)
}
if config.TargetOS == "windows" {
path += ".exe"
}
return path
}
// fromDirectoryName returns the executable path based on the directory name.