Merge pull request #511 from c9s/narumi/mkdir-build

build: mkdir if dir not exists
This commit is contained in:
Yo-An Lin 2022-04-08 18:51:15 +08:00 committed by GitHub
commit ed57ae6eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,6 +129,13 @@ func BuildTarget(ctx context.Context, userConfig *Config, target BuildTargetConf
buildDir = "build" buildDir = "build"
} }
if _, err := os.Stat(buildDir); os.IsNotExist(err) {
err = os.Mkdir(buildDir, 0777)
if err != nil {
return "", err
}
}
buildDir = filepath.Join(userConfig.Build.BuildDir, target.Name) buildDir = filepath.Join(userConfig.Build.BuildDir, target.Name)
return Build(ctx, userConfig, target) return Build(ctx, userConfig, target)
} }