mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
change path usage to filepath
This commit is contained in:
parent
05300fde1d
commit
7badd2eb0c
1 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -99,10 +99,10 @@ func NewContent(kind, name string) (err error) {
|
||||||
//page.Dir = viper.GetString("sourceDir")
|
//page.Dir = viper.GetString("sourceDir")
|
||||||
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat")))
|
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat")))
|
||||||
page.SetSourceContent(psr.Content())
|
page.SetSourceContent(psr.Content())
|
||||||
if err = page.SafeSaveSourceAs(path.Join(viper.GetString("contentDir"), name)); err != nil {
|
if err = page.SafeSaveSourceAs(filepath.Join(viper.GetString("contentDir"), name)); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jww.FEEDBACK.Println(helpers.AbsPathify(path.Join(viper.GetString("contentDir"), name)), "created")
|
jww.FEEDBACK.Println(helpers.AbsPathify(filepath.Join(viper.GetString("contentDir"), name)), "created")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ func FindArchetype(kind string) (outpath string) {
|
||||||
search := []string{helpers.AbsPathify(viper.GetString("archetypeDir"))}
|
search := []string{helpers.AbsPathify(viper.GetString("archetypeDir"))}
|
||||||
|
|
||||||
if viper.GetString("theme") != "" {
|
if viper.GetString("theme") != "" {
|
||||||
themeDir := path.Join(helpers.AbsPathify("themes/"+viper.GetString("theme")), "/archetypes/")
|
themeDir := filepath.Join(helpers.AbsPathify("themes/"+viper.GetString("theme")), "/archetypes/")
|
||||||
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
|
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
|
||||||
jww.ERROR.Println("Unable to find archetypes directory for theme :", viper.GetString("theme"), "in", themeDir)
|
jww.ERROR.Println("Unable to find archetypes directory for theme :", viper.GetString("theme"), "in", themeDir)
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,7 +131,7 @@ func FindArchetype(kind string) (outpath string) {
|
||||||
pathsToCheck = []string{kind + ".md", kind, "default.md", "default"}
|
pathsToCheck = []string{kind + ".md", kind, "default.md", "default"}
|
||||||
}
|
}
|
||||||
for _, p := range pathsToCheck {
|
for _, p := range pathsToCheck {
|
||||||
curpath := path.Join(x, p)
|
curpath := filepath.Join(x, p)
|
||||||
jww.DEBUG.Println("checking", curpath, "for archetypes")
|
jww.DEBUG.Println("checking", curpath, "for archetypes")
|
||||||
if exists, _ := helpers.Exists(curpath, hugofs.SourceFs); exists {
|
if exists, _ := helpers.Exists(curpath, hugofs.SourceFs); exists {
|
||||||
jww.INFO.Println("curpath: " + curpath)
|
jww.INFO.Println("curpath: " + curpath)
|
||||||
|
|
Loading…
Reference in a new issue