0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

core: Error if root directory is not found

This commit is contained in:
Matthew Holt 2015-05-01 13:35:43 -06:00
parent 7ee3653342
commit d11819721d

View file

@ -28,6 +28,16 @@ func init() {
return p.argErr()
}
p.cfg.Root = p.tkn()
// Ensure root folder exists
_, err := os.Stat(p.cfg.Root)
if err != nil {
if os.IsNotExist(err) {
return p.err("Path", "Root path "+p.cfg.Root+" does not exist")
} else {
return p.err("Path", "Unable to access root path "+p.cfg.Root)
}
}
return nil
},
"import": func(p *parser) error {