Version uses binary name instead of hugo
authorDan Hersam <dan@hersam.com>
Wed, 28 Jan 2015 01:09:10 +0000 (20:09 -0500)
committerbep <bjorn.erik.pedersen@gmail.com>
Wed, 28 Jan 2015 08:43:12 +0000 (09:43 +0100)
On Windows the binary name is hugo.exe and running hugo version results in
this error:
    GetFileAttributesEx D:\Dev\Go\gopath\bin\hugo: The system cannot find the file specified.

This fixes that error and allows the binary name to be something other
than hugo on any OS.

commands/version.go

index 41ada569459811172555ed899183cf40931540f0..799ff70df74cfc2b829f96705058093e1d77eed5 100644 (file)
@@ -58,7 +58,7 @@ func setBuildDate() {
                fmt.Println(err)
                return
        }
-       fi, err := os.Lstat(filepath.Join(dir, "hugo"))
+       fi, err := os.Lstat(filepath.Join(dir, filepath.Base(fname)))
        if err != nil {
                fmt.Println(err)
                return