Skip to content

Commit

Permalink
add has profile boolean to stat call
Browse files Browse the repository at this point in the history
  • Loading branch information
cfi2017 committed Apr 9, 2020
1 parent 28e6e37 commit 92ef37e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ func Start() error {
}))

r.GET("/stats", func(c *gin.Context) {
_, err := os.Stat(pwd + "/profile.sav")
c.JSON(200, &struct {
Pwd string `json:"pwd"`
Pwd string `json:"pwd"`
HasProfile bool `json:"hasProfile"`
}{
Pwd: pwd,
Pwd: pwd,
HasProfile: err == nil && !os.IsNotExist(err),
})
})

Expand Down

0 comments on commit 92ef37e

Please sign in to comment.