hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 9b2028626e2e50f6d3502bcd87543aa4bd5d04d0
parent c99761555c014e4d041438d5d7e53a6cbaee4492
Author: Albert Nigmatzianov <albertnigma@gmail.com>
Date:   Mon,  8 May 2017 17:55:48 +0200

commands: Use paths from PathSpec for walker

Diffstat:
Mcommands/benchmark.go | 1-
Mcommands/hugo.go | 15+++++----------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/commands/benchmark.go b/commands/benchmark.go
@@ -49,7 +49,6 @@ func init() {
 
 func benchmark(cmd *cobra.Command, args []string) error {
 	cfg, err := InitializeConfig(benchmarkCmd)
-
 	if err != nil {
 		return err
 	}
diff --git a/commands/hugo.go b/commands/hugo.go
@@ -616,13 +616,8 @@ func (c *commandeer) getDirList() []string {
 	var a []string
 	dataDir := c.PathSpec().AbsPathify(c.Cfg.GetString("dataDir"))
 	i18nDir := c.PathSpec().AbsPathify(c.Cfg.GetString("i18nDir"))
-	layoutDir := c.PathSpec().AbsPathify(c.Cfg.GetString("layoutDir"))
-	staticDir := c.PathSpec().AbsPathify(c.Cfg.GetString("staticDir"))
-	var themesDir string
-
-	if c.PathSpec().ThemeSet() {
-		themesDir = c.PathSpec().AbsPathify(c.Cfg.GetString("themesDir") + "/" + c.Cfg.GetString("theme"))
-	}
+	layoutDir := c.PathSpec().GetLayoutDirPath()
+	staticDir := c.PathSpec().GetStaticDirPath()
 
 	walker := func(path string, fi os.FileInfo, err error) error {
 		if err != nil {
@@ -686,15 +681,15 @@ func (c *commandeer) getDirList() []string {
 	_ = helpers.SymbolicWalk(c.Fs.Source, dataDir, walker)
 	_ = helpers.SymbolicWalk(c.Fs.Source, c.PathSpec().AbsPathify(c.Cfg.GetString("contentDir")), walker)
 	_ = helpers.SymbolicWalk(c.Fs.Source, i18nDir, walker)
-	_ = helpers.SymbolicWalk(c.Fs.Source, c.PathSpec().AbsPathify(c.Cfg.GetString("layoutDir")), walker)
-
+	_ = helpers.SymbolicWalk(c.Fs.Source, layoutDir, walker)
 	_ = helpers.SymbolicWalk(c.Fs.Source, staticDir, walker)
+
 	if c.PathSpec().ThemeSet() {
+		themesDir := c.PathSpec().GetThemeDir()
 		_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "layouts"), walker)
 		_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "static"), walker)
 		_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "i18n"), walker)
 		_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "data"), walker)
-
 	}
 
 	return a