1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-14 14:37:20 +00:00

Use filepath.Join instead of path.Join for file system file operations (#33978)

This commit is contained in:
Lunny Xiao
2025-03-24 14:50:28 -07:00
committed by GitHub
parent 82bc8b8ce6
commit 3fe449c21a
12 changed files with 23 additions and 56 deletions

View File

@ -38,7 +38,7 @@ var currentEngine *xorm.Engine
func initMigrationTest(t *testing.T) func() {
testlogger.Init()
giteaRoot := test.SetupGiteaRoot()
setting.AppPath = path.Join(giteaRoot, "gitea")
setting.AppPath = filepath.Join(giteaRoot, "gitea")
if _, err := os.Stat(setting.AppPath); err != nil {
testlogger.Fatalf(fmt.Sprintf("Could not find gitea binary at %s\n", setting.AppPath))
}
@ -47,7 +47,7 @@ func initMigrationTest(t *testing.T) func() {
if giteaConf == "" {
testlogger.Fatalf("Environment variable $GITEA_CONF not set\n")
} else if !path.IsAbs(giteaConf) {
setting.CustomConf = path.Join(giteaRoot, giteaConf)
setting.CustomConf = filepath.Join(giteaRoot, giteaConf)
} else {
setting.CustomConf = giteaConf
}
@ -55,7 +55,7 @@ func initMigrationTest(t *testing.T) func() {
unittest.InitSettings()
assert.NotEmpty(t, setting.RepoRootPath)
assert.NoError(t, unittest.SyncDirs(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
assert.NoError(t, unittest.SyncDirs(filepath.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
assert.NoError(t, git.InitFull(t.Context()))
setting.LoadDBSetting()
setting.InitLoggersForTest()