Skip to content

Commit

Permalink
fix empty pwd path read from gfile.Pwd() which could cause internal…
Browse files Browse the repository at this point in the history
… error logging for `gview.New` (#3302)
  • Loading branch information
hailaz authored Feb 5, 2024
1 parent 7415ec3 commit 553cc45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions os/gview/gview.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ func New(path ...string) *View {
}
} else {
// Dir path of working dir.
if err := view.SetPath(gfile.Pwd()); err != nil {
intlog.Errorf(context.TODO(), `%+v`, err)
if pwdPath := gfile.Pwd(); pwdPath != "" {
if err := view.SetPath(pwdPath); err != nil {
intlog.Errorf(context.TODO(), `%+v`, err)
}
}
// Dir path of binary.
if selfPath := gfile.SelfDir(); selfPath != "" && gfile.Exists(selfPath) {
Expand Down

0 comments on commit 553cc45

Please sign in to comment.