Add gogs fix location command

This commit is contained in:
Unknown 2014-06-10 19:11:53 -04:00
parent f160b4f33c
commit a3e1383cac
10 changed files with 179 additions and 40 deletions

View file

@ -90,8 +90,7 @@ var (
RunUser string
)
// WorkDir returns absolute path of work directory.
func WorkDir() (string, error) {
func ExecPath() (string, error) {
file, err := exec.LookPath(os.Args[0])
if err != nil {
return "", err
@ -100,7 +99,13 @@ func WorkDir() (string, error) {
if err != nil {
return "", err
}
return path.Dir(strings.Replace(p, "\\", "/", -1)), nil
return p, nil
}
// WorkDir returns absolute path of work directory.
func WorkDir() (string, error) {
execPath, err := ExecPath()
return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err
}
// NewConfigContext initializes configuration context.