mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
add check for invalid img path
This commit is contained in:
parent
6b266e8fb7
commit
e2e39e0690
@ -67,6 +67,11 @@ func loadConfig(path string) Config {
|
|||||||
defer jsonObject.Close()
|
defer jsonObject.Close()
|
||||||
decoder := json.NewDecoder(jsonObject)
|
decoder := json.NewDecoder(jsonObject)
|
||||||
_ = decoder.Decode(&config)
|
_ = decoder.Decode(&config)
|
||||||
|
_, err = os.Stat(config.ImgPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Your image path %s is incorrect.Please check and confirm.", config.ImgPath)
|
||||||
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user