os/gcfg: fix gcfg adaptfile dogetfilepath (#3587)

This commit is contained in:
ynwcel 2024-05-20 20:23:38 +08:00 committed by GitHub
parent 737da954a0
commit 1455440efa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -216,9 +216,9 @@ func (a *AdapterFile) doGetFilePath(fileName string) (filePath string) {
// Searching local file system.
if filePath == "" {
// Absolute path.
if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) {
/*if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) {
return
}
}*/
a.searchPaths.RLockFunc(func(array []string) {
for _, searchPath := range array {
searchPath = gstr.TrimRight(searchPath, `\/`)
@ -235,6 +235,12 @@ func (a *AdapterFile) doGetFilePath(fileName string) (filePath string) {
}
})
}
if filePath == "" {
// Absolute path.
if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) {
return
}
}
return
}