Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(os/gcfg): SetPath failed when there's config.yaml in current working directory #3587

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix-cfg-adaptfile-dogetfilepath
  • Loading branch information
ynwcel committed May 17, 2024
commit 9853b15227045c40edbb05e73a7834b6e820ea88
10 changes: 8 additions & 2 deletions os/gcfg/gcfg_adapter_file_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, `\/`)
Expand All @@ -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
}

Expand Down
Loading