base.go 589 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package base
  5. import (
  6. "os"
  7. "os/exec"
  8. "path/filepath"
  9. )
  10. const DOC_URL = "https://github.com/gogits/go-gogs-client/wiki"
  11. type (
  12. TplName string
  13. )
  14. var GoGetMetas = make(map[string]bool)
  15. // ExecPath returns the executable path.
  16. func ExecPath() (string, error) {
  17. file, err := exec.LookPath(os.Args[0])
  18. if err != nil {
  19. return "", err
  20. }
  21. p, err := filepath.Abs(file)
  22. if err != nil {
  23. return "", err
  24. }
  25. return p, nil
  26. }