Checks to ensure theme directory, if specified, exists

See #1234
This commit is contained in:
Scott C Wilson 2015-07-12 13:25:43 -04:00 committed by Bjørn Erik Pedersen
parent a2fa3895ee
commit 029cdb68f5

View file

@ -278,7 +278,16 @@ func InitializeConfig() {
jww.INFO.Println("Using config file:", viper.ConfigFileUsed())
themeDir := helpers.GetThemeDir()
if themeDir != "" {
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
jww.ERROR.Println("Unable to find theme Directory:", themeDir)
os.Exit(1)
}
}
themeVersionMismatch, minVersion := helpers.IsThemeVsHugoVersionMismatch()
if themeVersionMismatch {
jww.ERROR.Printf("Current theme does not support Hugo version %s. Minimum version required is %s\n",
helpers.HugoReleaseVersion(), minVersion)