Skip to content

Commit

Permalink
Change GetSystemInformation to use root path of Wings instead of "/"
Browse files Browse the repository at this point in the history
  • Loading branch information
chredeur committed Oct 27, 2024
1 parent d037434 commit ecedbd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion router/router_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

// Returns information about the system that wings is running on.
func getSystemInformation(c *gin.Context) {
i, err := system.GetSystemInformation()
i, err := system.GetSystemInformation(config.Get().System.RootDirectory)
if err != nil {
middleware.CaptureAndAbort(c, err)
return
Expand Down
5 changes: 2 additions & 3 deletions system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type System struct {
OSType string `json:"os_type"`
}

func GetSystemInformation() (*Information, error) {
func GetSystemInformation(rootDirectoryPath string) (*Information, error) {
k, err := kernel.GetKernelVersion()
if err != nil {
return nil, err
Expand Down Expand Up @@ -114,15 +114,14 @@ func GetSystemInformation() (*Information, error) {
memPercentUsage, memBytesUsage = &v, &memStats.Used
}

diskStats, err := disk.Usage("/")
diskStats, err := disk.Usage(rootDirectoryPath)
var diskBytes, diskBytesUsage *uint64
var diskPercentUsage *float64
if err == nil {
diskBytes, diskBytesUsage = &diskStats.Total, &diskStats.Used
v := math.Round(diskStats.UsedPercent*100) / 100
diskPercentUsage = &v
}

return &Information{
Version: Version,
Docker: DockerInformation{
Expand Down

0 comments on commit ecedbd8

Please sign in to comment.