Fix geo resource download path

This commit is contained in:
世界 2023-03-01 11:21:59 +08:00
parent b14ae51f71
commit 6da1460795
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -898,10 +898,9 @@ func (r *Router) prepareGeoIPDatabase() error {
geoPath = "geoip.db" geoPath = "geoip.db"
if foundPath, loaded := C.FindPath(geoPath); loaded { if foundPath, loaded := C.FindPath(geoPath); loaded {
geoPath = foundPath geoPath = foundPath
} else {
geoPath = C.BasePath(geoPath)
} }
} }
geoPath = C.BasePath(geoPath)
if !rw.FileExists(geoPath) { if !rw.FileExists(geoPath) {
r.logger.Warn("geoip database not exists: ", geoPath) r.logger.Warn("geoip database not exists: ", geoPath)
var err error var err error
@ -935,10 +934,9 @@ func (r *Router) prepareGeositeDatabase() error {
geoPath = "geosite.db" geoPath = "geosite.db"
if foundPath, loaded := C.FindPath(geoPath); loaded { if foundPath, loaded := C.FindPath(geoPath); loaded {
geoPath = foundPath geoPath = foundPath
} else {
geoPath = C.BasePath(geoPath)
} }
} }
geoPath = C.BasePath(geoPath)
if !rw.FileExists(geoPath) { if !rw.FileExists(geoPath) {
r.logger.Warn("geosite database not exists: ", geoPath) r.logger.Warn("geosite database not exists: ", geoPath)
var err error var err error