mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Replace some leftover os.Stat with hugofs.Source
This commit is contained in:
parent
ef3c4a56d8
commit
c700cdc39c
3 changed files with 6 additions and 4 deletions
|
@ -408,7 +408,7 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
|
|||
|
||||
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 @@ func getDirList() []string {
|
|||
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
|
||||
|
|
|
@ -23,6 +23,8 @@ import (
|
|||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/text/transform"
|
||||
|
@ -194,7 +196,7 @@ func getThemeDirPath(path string) (string, error) {
|
|||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ func (f *Filesystem) shouldRead(filePath string, fi os.FileInfo) (bool, error) {
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue