Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637package config
import ( "path/filepath" "strings")
// Executable returns the path to the executable.func (build *Build) Executable() string { path, err := filepath.Abs(build.Files[0])
if err != nil { panic(err) }
if strings.HasSuffix(path, ".q") { path = fromFileName(path) } else { path = fromDirectoryName(path) }
if build.OS == Windows { path += ".exe" }
return path}
// fromFileName returns the executable path based on the file name.func fromFileName(path string) string { return filepath.Join(filepath.Dir(path), strings.TrimSuffix(filepath.Base(path), ".q"))}
// fromDirectoryName returns the executable path based on the directory name.func fromDirectoryName(path string) string { return filepath.Join(path, filepath.Base(path))}