diff --git a/browse/post.go b/browse/post.go index cbad12ba..305a3d8f 100644 --- a/browse/post.go +++ b/browse/post.go @@ -62,7 +62,7 @@ func POST(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) args = append(args, "--kind", archetype) } - if err := utils.RunCommand("hugo", args, c.Path); err != nil { + if err := utils.RunCommand(c.Hugo, args, c.Path); err != nil { return http.StatusInternalServerError, err } } else { diff --git a/config/config.go b/config/config.go index 8776fa45..35211f7b 100644 --- a/config/config.go +++ b/config/config.go @@ -1,10 +1,10 @@ package config import ( - "fmt" "log" "os" "os/user" + "path/filepath" "runtime" "strings" @@ -40,8 +40,9 @@ func ParseHugo(c *setup.Controller) (*Config, error) { conf.Hugo += ".exe" } + conf.Hugo = filepath.Clean(conf.Hugo) + if _, err := os.Stat(conf.Hugo); os.IsNotExist(err) { - fmt.Print("hey") insthugo.Install() } diff --git a/hugo.go b/hugo.go index 0fb11db0..001d0cb5 100644 --- a/hugo.go +++ b/hugo.go @@ -45,7 +45,7 @@ func Setup(c *setup.Controller) (middleware.Middleware, error) { } if create { - err := utils.RunCommand("hugo", []string{"new", "site", config.Path, "--force"}, ".") + err := utils.RunCommand(config.Hugo, []string{"new", "site", config.Path, "--force"}, ".") if err != nil { log.Panic(err) } diff --git a/utils/utils.go b/utils/utils.go index 4a8d9cb1..5f2f7cf6 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -178,7 +178,7 @@ func Run(c *config.Config, force bool) { } } - if err := RunCommand("hugo", c.Args, c.Path); err != nil { + if err := RunCommand(c.Hugo, c.Args, c.Path); err != nil { log.Panic(err) } }