pull/60/merge
Henrique Dias 2016-07-02 21:49:43 +01:00
parent 6d3817d6ce
commit fd24071850
1 changed files with 11 additions and 2 deletions

View File

@ -31,12 +31,15 @@ func GetPath() string {
initializeVariables() initializeVariables()
var err error var err error
found := false
// Check if Hugo is already on $PATH // Check if Hugo is already on $PATH
if hugo, err = exec.LookPath("hugo"); err == nil { if hugo, err = exec.LookPath("hugo"); err == nil {
if checkVersion() { if checkVersion() {
return hugo return hugo
} }
found = true
} }
// Check if Hugo is on $HOME/.caddy/bin // Check if Hugo is on $HOME/.caddy/bin
@ -44,9 +47,15 @@ func GetPath() string {
if checkVersion() { if checkVersion() {
return hugo return hugo
} }
found = true
} }
fmt.Println("Unable to find Hugo on your computer.") if found {
fmt.Println("We will update your hugo to the newest version.")
} else {
fmt.Println("Unable to find Hugo on your computer.")
}
// Create the neccessary folders // Create the neccessary folders
os.MkdirAll(caddy, 0774) os.MkdirAll(caddy, 0774)
@ -64,7 +73,7 @@ func GetPath() string {
// Unzip or Ungzip the file // Unzip or Ungzip the file
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "windows": case "windows":
zp := extractor.NewZip() zp := extractor.NewZip()
err = zp.Extract(tempfile, temp) err = zp.Extract(tempfile, temp)
default: default: