Skip to content

Commit 10abb30

Browse files
mwfarbjuagargi
authored andcommitted
add paths sanity check
1 parent 44aedf1 commit 10abb30

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

webapp/webapp.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ func ensurePath(srcpath, staticDir string) string {
111111
}
112112
return dir
113113
}
114+
func checkPath(dir string) {
115+
if _, err := os.Stat(dir); os.IsNotExist(err) {
116+
CheckError(err)
117+
}
118+
}
114119

115120
func main() {
116121
flag.Parse()
@@ -132,6 +137,15 @@ func main() {
132137
fmt15.Fmt15Format(nil)))))
133138
log.Info("======================> Webapp started")
134139

140+
checkPath(options.StaticRoot)
141+
checkPath(options.BrowseRoot)
142+
checkPath(options.AppsRoot)
143+
checkPath(options.ScionRoot)
144+
checkPath(options.ScionBin)
145+
checkPath(options.ScionGen)
146+
checkPath(options.ScionGenCache)
147+
checkPath(options.ScionLogs)
148+
135149
// prepare templates
136150
templates = prepareTemplates(options.StaticRoot)
137151
// open and manage database

0 commit comments

Comments
 (0)