diff options
Diffstat (limited to 'cmd/build')
-rw-r--r-- | cmd/build/build.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/build/build.go b/cmd/build/build.go index 8a8cd68..058b82f 100644 --- a/cmd/build/build.go +++ b/cmd/build/build.go @@ -402,12 +402,11 @@ func outputToFile(output io.Reader, filename ...string) error { return nil } -func build() error { +func build(outDir string) error { config, err := config.GetConfig() if err != nil { return err } - outDir := "public" if err := mkdirp(outDir, "post"); err != nil { return errors.WithMessage(err, "could not create post output directory") } @@ -530,18 +529,19 @@ func main() { log.Panic(errors.Errorf("working directory does not exist: %v", err)) } + outDir := "public" err = os.RemoveAll("public") if err != nil { log.Panic(errors.Errorf("could not remove public directory: %v", err)) } - err = cp.Copy("static", "public", cp.Options{ - PreserveTimes: true, + err = cp.Copy("static", outDir, cp.Options{ + PreserveTimes: true, }) if err != nil { log.Panic(errors.Errorf("could not copy static files: %v", err)) } - if err := build(); err != nil { + if err := build(outDir); err != nil { switch cause := errors.Cause(err).(type) { case *fs.PathError: slog.Info("pathError") |