mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
fix: prevent panic when static_dir does not exist
This commit is contained in:
parent
e53cf41aa0
commit
c67f45b15e
7
main.go
7
main.go
|
@ -88,6 +88,10 @@ func (s *Site) runTask(task *Task) error {
|
|||
if task.StaticDir != "" {
|
||||
err := copyAll(task.StaticDir, task.OutputDir)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
log.Printf("static_dir '%s' does not exist\n", task.StaticDir)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +100,9 @@ func (s *Site) runTask(task *Task) error {
|
|||
|
||||
func copyAll(srcDir, dstDir string) error {
|
||||
return filepath.Walk(srcDir, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
// Do nothing
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue