Fileserver/internal/validation/directories.go
2025-08-13 09:44:02 +02:00

20 lines
582 B
Go

package validation
import (
"fmt"
"git.zervo.org/zervo/fileserver/internal/config"
"git.zervo.org/zervo/fileserver/internal/util"
)
// ValidateDirectories ensure the given directories meet the required criteria to be served.
// Any directory that doesn't meet the requirements gets removed from the slice.
func ValidateDirectories(dirs []config.DirectoryConfig) {
for _, dir := range dirs {
exists, err := util.FileExists(dir.Path)
if !exists {
fmt.Printf("WARNING: The directory '%s' does not exist and will be delisted. %v", dir.Id, err)
//dirs[i] = nil
}
}
}