summaryrefslogtreecommitdiffstats
path: root/hugolib/config.go
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2014-02-27 18:32:09 -0500
committerspf13 <steve.francia@gmail.com>2014-02-27 20:33:18 -0500
commit14227351fad4acda28c9de90b593c952026f2911 (patch)
tree00157055ea1eac533db7ea07dc5043f06c129916 /hugolib/config.go
parent64572d2d60a6bee0cc0b87dcf0a944d88375d964 (diff)
Reorganization of helpers. Centralized Url/Path logic. Fixed #175.
Diffstat (limited to 'hugolib/config.go')
-rw-r--r--hugolib/config.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/hugolib/config.go b/hugolib/config.go
index df1b87ec6..a52b0737c 100644
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -17,6 +17,7 @@ import (
"encoding/json"
"fmt"
"github.com/BurntSushi/toml"
+ "github.com/spf13/hugo/helpers"
"io/ioutil"
"launchpad.net/goyaml"
"os"
@@ -67,7 +68,7 @@ func SetupConfig(cfgfile *string, path *string) *Config {
c.readInConfig()
// set index defaults if none provided
- if len(c.Indexes) == 0 {
+ if c.Indexes == nil {
c.Indexes = make(map[string]string)
c.Indexes["tag"] = "tags"
c.Indexes["category"] = "categories"
@@ -169,15 +170,15 @@ func (c *Config) GetAbsPath(name string) string {
func (c *Config) findConfigFile(configFileName string) (string, error) {
if configFileName == "" { // config not specified, let's search
- if b, _ := exists(c.GetAbsPath("config.json")); b {
+ if b, _ := helpers.Exists(c.GetAbsPath("config.json")); b {
return c.GetAbsPath("config.json"), nil
}
- if b, _ := exists(c.GetAbsPath("config.toml")); b {
+ if b, _ := helpers.Exists(c.GetAbsPath("config.toml")); b {
return c.GetAbsPath("config.toml"), nil
}
- if b, _ := exists(c.GetAbsPath("config.yaml")); b {
+ if b, _ := helpers.Exists(c.GetAbsPath("config.yaml")); b {
return c.GetAbsPath("config.yaml"), nil
}
@@ -191,7 +192,7 @@ func (c *Config) findConfigFile(configFileName string) (string, error) {
// Else check the local directory
t := c.GetAbsPath(configFileName)
- if b, _ := exists(t); b {
+ if b, _ := helpers.Exists(t); b {
return t, nil
} else {
return "", fmt.Errorf("config file not found at: %s", t)