mirror of
https://github.com/go-gitea/gitea
synced 2024-11-04 17:24:26 +00:00
Bug fix
This commit is contained in:
parent
4b08d3aacf
commit
269281ab76
@ -11,6 +11,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -20,7 +21,6 @@ import (
|
|||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
qlog "github.com/qiniu/log"
|
qlog "github.com/qiniu/log"
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/base"
|
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,6 +41,15 @@ var (
|
|||||||
appPath string // Execution(binary) path.
|
appPath string // Execution(binary) path.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// exePath returns the executable path.
|
||||||
|
func exePath() (string, error) {
|
||||||
|
file, err := exec.LookPath(os.Args[0])
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return filepath.Abs(file)
|
||||||
|
}
|
||||||
|
|
||||||
// homeDir returns the home directory of current user.
|
// homeDir returns the home directory of current user.
|
||||||
func homeDir() string {
|
func homeDir() string {
|
||||||
home, err := com.HomeDir()
|
home, err := com.HomeDir()
|
||||||
@ -53,7 +62,7 @@ func homeDir() string {
|
|||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if appPath, err = base.ExecDir(); err != nil {
|
if appPath, err = exePath(); err != nil {
|
||||||
qlog.Fatalf("publickey.init(fail to get app path): %v\n", err)
|
qlog.Fatalf("publickey.init(fail to get app path): %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user