shithub: hugo

Download patch

ref: c700cdc39cdf6b8801b71b70f704d749650585fd
parent: ef3c4a56d8c5e62588b315cea800a15160ea4eb5
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Sep 11 15:59:07 EDT 2016

Replace some leftover os.Stat with hugofs.Source

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -408,7 +408,7 @@
 
 	themeDir := helpers.GetThemeDir()
 	if themeDir != "" {
-		if _, err := os.Stat(themeDir); os.IsNotExist(err) {
+		if _, err := hugofs.Source().Stat(themeDir); os.IsNotExist(err) {
 			return newSystemError("Unable to find theme Directory:", themeDir)
 		}
 	}
@@ -593,7 +593,7 @@
 				jww.ERROR.Printf("Cannot read symbolic link '%s', error was: %s", path, err)
 				return nil
 			}
-			linkfi, err := os.Stat(link)
+			linkfi, err := hugofs.Source().Stat(link)
 			if err != nil {
 				jww.ERROR.Printf("Cannot stat '%s', error was: %s", link, err)
 				return nil
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -23,6 +23,8 @@
 	"strings"
 	"unicode"
 
+	"github.com/spf13/hugo/hugofs"
+
 	"github.com/spf13/afero"
 	"github.com/spf13/viper"
 	"golang.org/x/text/transform"
@@ -194,7 +196,7 @@
 	}
 
 	themeDir := filepath.Join(GetThemeDir(), path)
-	if _, err := os.Stat(themeDir); os.IsNotExist(err) {
+	if _, err := hugofs.Source().Stat(themeDir); os.IsNotExist(err) {
 		return "", fmt.Errorf("Unable to find %s directory for theme %s in %s", path, viper.GetString("theme"), themeDir)
 	}
 
--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -119,7 +119,7 @@
 			jww.ERROR.Printf("Cannot read symbolic link '%s', error was: %s", filePath, err)
 			return false, nil
 		}
-		linkfi, err := os.Stat(link)
+		linkfi, err := hugofs.Source().Stat(link)
 		if err != nil {
 			jww.ERROR.Printf("Cannot stat '%s', error was: %s", link, err)
 			return false, nil