diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-10 19:11:53 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-10 19:11:53 -0400 |
commit | a3e1383cac3dfa2a71b04b47a295e9836fcb0d50 (patch) | |
tree | 402818d9b343a921f5c372972fa237a91e40d0f5 /modules | |
parent | f160b4f33ca69df13b071648aad09e561dafec26 (diff) | |
download | gitea-a3e1383cac3dfa2a71b04b47a295e9836fcb0d50.tar.gz gitea-a3e1383cac3dfa2a71b04b47a295e9836fcb0d50.zip |
Add gogs fix location command
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/setting.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 35c9165139..73ec8ddd1b 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -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. |