summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-02-14 12:16:03 +0100
committerSteve Francia <steve.francia@gmail.com>2016-03-21 19:13:29 -0400
commite5aa47749157e4c49a645d37df89fa76b0e8f952 (patch)
tree357f08c588583925d8e7a1d28e63b9f2b83a027a /commands
parent6258d48b0220fa59edf50a32031677eb7b7944d4 (diff)
Add support for symbolic links for content, layout, static, theme
Note: This is for the content roots only, but that should satisfy most needs. Fixes #1855
Diffstat (limited to 'commands')
-rw-r--r--commands/hugo.go14
-rw-r--r--commands/import_jekyll.go2
2 files changed, 8 insertions, 8 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index daf483923..78a416d65 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -17,6 +17,7 @@ package commands
import (
"fmt"
+ "github.com/spf13/hugo/hugofs"
"io/ioutil"
"net/http"
"os"
@@ -35,7 +36,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/fsync"
"github.com/spf13/hugo/helpers"
- "github.com/spf13/hugo/hugofs"
"github.com/spf13/hugo/hugolib"
"github.com/spf13/hugo/livereload"
"github.com/spf13/hugo/utils"
@@ -651,12 +651,12 @@ func getDirList() []string {
return nil
}
- filepath.Walk(dataDir, walker)
- filepath.Walk(helpers.AbsPathify(viper.GetString("ContentDir")), walker)
- filepath.Walk(helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
- filepath.Walk(helpers.AbsPathify(viper.GetString("StaticDir")), walker)
+ helpers.SymbolicWalk(hugofs.SourceFs, dataDir, walker)
+ helpers.SymbolicWalk(hugofs.SourceFs, helpers.AbsPathify(viper.GetString("ContentDir")), walker)
+ helpers.SymbolicWalk(hugofs.SourceFs, helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
+ helpers.SymbolicWalk(hugofs.SourceFs, helpers.AbsPathify(viper.GetString("StaticDir")), walker)
if helpers.ThemeSet() {
- filepath.Walk(helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), walker)
+ helpers.SymbolicWalk(hugofs.SourceFs, helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), walker)
}
return a
@@ -769,7 +769,7 @@ func NewWatcher(port int) error {
// When mkdir -p is used, only the top directory triggers an event (at least on OSX)
if ev.Op&fsnotify.Create == fsnotify.Create {
if s, err := hugofs.SourceFs.Stat(ev.Name); err == nil && s.Mode().IsDir() {
- afero.Walk(hugofs.SourceFs, ev.Name, walkAdder)
+ helpers.SymbolicWalk(hugofs.SourceFs, ev.Name, walkAdder)
}
}
diff --git a/commands/import_jekyll.go b/commands/import_jekyll.go
index 820948174..40d243375 100644
--- a/commands/import_jekyll.go
+++ b/commands/import_jekyll.go
@@ -124,7 +124,7 @@ func importFromJekyll(cmd *cobra.Command, args []string) error {
return convertJekyllPost(path, relPath, targetDir, draft)
}
- err = filepath.Walk(jekyllRoot, callback)
+ err = helpers.SymbolicWalk(hugofs.OsFs, jekyllRoot, callback)
if err != nil {
return err