commands: Use paths from PathSpec for walker
authorAlbert Nigmatzianov <albertnigma@gmail.com>
Mon, 8 May 2017 15:55:48 +0000 (17:55 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 9 May 2017 12:07:43 +0000 (14:07 +0200)
commands/benchmark.go
commands/hugo.go

index 6c42992a0234028b28b35f70be546c676206d854..51f2be8766abb9bc7931dc79be1c53bf2d5a8af3 100644 (file)
@@ -49,7 +49,6 @@ func init() {
 
 func benchmark(cmd *cobra.Command, args []string) error {
        cfg, err := InitializeConfig(benchmarkCmd)
-
        if err != nil {
                return err
        }
index ce246efd0b3f0e8cfd6719aad960c6f82b05623e..4c12ccc7df5c5799b69042a99f3e3dffa8253154 100644 (file)
@@ -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