Skip to content

Commit

Permalink
Make sure we always create the /public folder
Browse files Browse the repository at this point in the history
* Before this commit, when you had static files in the root of /content and no /public folder, that folder would not be created unless the /static syncer had already run.
* So, with a common pattern doing `rm -rf public && hugo` would the fail now and then because /static and /content are processed in parallel (unless you have cleanDestinationDir=true)
* This was even worse before commit 0b918e1 – a frozen build.

Closes #8166
  • Loading branch information
bep committed Dec 23, 2021
1 parent bd63c1a commit aee9e11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hugolib/filesystems/basefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ func NewBase(p *paths.Paths, logger loggers.Logger, options ...func(*BaseFs) err
logger = loggers.NewWarningLogger()
}

// Make sure we always have the /public folder ready to use.
if err := fs.Destination.MkdirAll(p.AbsPublishDir, 0777); err != nil && !os.IsExist(err) {
return nil, err
}

publishFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Destination, p.AbsPublishDir))
sourceFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Source, p.WorkingDir))

Expand Down

0 comments on commit aee9e11

Please sign in to comment.