Allow data generator to be run directly from Bazel

When run from Bazel without additional arguments, it will write data
files directly to the source directory.
This commit is contained in:
Dietrich Epp 2022-03-23 12:00:18 -04:00
parent 7e7a6a9da2
commit 491950e57d
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ func getSrcdir() (string, error) {
if flagSrc != "" {
return flagSrc, nil
}
workspace := os.Getenv("BUILD_WORKSPACE_DIRECTORY")
if workspace != "" {
return workspace, nil
}
exe, err := os.Executable()
if err != nil {
return "", err