Do not ERROR-log missing /data dir
authorbep <bjorn.erik.pedersen@gmail.com>
Thu, 12 Mar 2015 20:44:36 +0000 (21:44 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Thu, 12 Mar 2015 20:44:36 +0000 (21:44 +0100)
Fixes #930

commands/hugo.go

index 13eadaa525fda06d2a93bcda46daa24072c343bd..f8e392243bbcf1b680e7013f269312357744ffb5 100644 (file)
@@ -295,8 +295,14 @@ func copyStatic() error {
 // getDirList provides NewWatcher() with a list of directories to watch for changes.
 func getDirList() []string {
        var a []string
+       dataDir := helpers.AbsPathify(viper.GetString("DataDir"))
        walker := func(path string, fi os.FileInfo, err error) error {
                if err != nil {
+                       if path == dataDir && os.IsNotExist(err) {
+                               jww.WARN.Println("Skip DataDir:", err)
+                               return nil
+
+                       }
                        jww.ERROR.Println("Walker: ", err)
                        return nil
                }
@@ -328,7 +334,7 @@ func getDirList() []string {
                return nil
        }
 
-       filepath.Walk(helpers.AbsPathify(viper.GetString("DataDir")), walker)
+       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)