Improved Windows support

This commit is contained in:
Eduard Urbach 2024-08-14 13:41:22 +02:00
parent 7eff85cb2e
commit 074ce25997
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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.