ソースを参照

Make gitea work using cmd.exe again (#22073)

Gitea will attempt to lookup its location using LookPath however, this
fails on cmd.exe if gitea is in the current working directory.

exec.LookPath will return an exec.ErrDot error which we can test for and
then simply using filepath.Abs(os.Args[0]) to absolute gitea against the
current working directory.

Fix #22063

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
tags/v1.19.0-rc0
zeripath 1年前
コミット
4fb2006ca1
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更7行の追加0行の削除
  1. 7
    0
      modules/setting/setting.go

+ 7
- 0
modules/setting/setting.go ファイルの表示

@@ -465,6 +465,13 @@ func getAppPath() (string, error) {
appPath, err = exec.LookPath(os.Args[0])
}

if err != nil {
// FIXME: Once we switch to go 1.19 use !errors.Is(err, exec.ErrDot)
if !strings.Contains(err.Error(), "cannot run executable found relative to current directory") {
return "", err
}
appPath, err = filepath.Abs(os.Args[0])
}
if err != nil {
return "", err
}

読み込み中…
キャンセル
保存