Executable returns the path to the executable.
()
| 7 | |
| 8 | // Executable returns the path to the executable. |
| 9 | func (build *Build) Executable() string { |
| 10 | path, err := filepath.Abs(build.Files[0]) |
| 11 | |
| 12 | if err != nil { |
| 13 | panic(err) |
| 14 | } |
| 15 | |
| 16 | if strings.HasSuffix(path, ".q") { |
| 17 | path = fromFileName(path) |
| 18 | } else { |
| 19 | path = fromDirectoryName(path) |
| 20 | } |
| 21 | |
| 22 | if build.OS == Windows { |
| 23 | path += ".exe" |
| 24 | } |
| 25 | |
| 26 | return path |
| 27 | } |
| 28 | |
| 29 | // fromFileName returns the executable path based on the file name. |
| 30 | func fromFileName(path string) string { |