Files
Reims-Go/internal/host/drives_other.go
T
NwflowerandClaude Opus 5.5 f6f6bfce34 feat: online runtime install, first-launch data folder picker, source packages
- Runtime: list and fetch runtimes from this repo's GitHub Releases
  (stable by default, candidate on request), with SHA256 check and resume.
  CLI gains `runtime available` and `runtime fetch`; the host page gets an
  online install row and a "receive candidates" switch.
- First launch: pick a data folder (non-system drives first, USB never
  recommended); the choice is recorded in %APPDATA%\reims-go\location.json.
  Existing installs in the default folder are adopted without asking.
- pack-runtime.ps1: also builds the matching source package, records every
  patch with its SHA256 and the channel, and refuses undeclared changes in
  the build trees.
- patches: declare reims-vgpu-cargo-lock.patch (Cargo.lock source lines).
- UI: sidebar and VM page restyle, new design tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 04:11:37 -07:00

36 lines
783 B
Go

//go:build !windows
package host
import (
"os"
"syscall"
)
// Drive is a disk a data folder could go on.
type Drive struct {
Root string `json:"root"`
FreeGB float64 `json:"free_gb"`
System bool `json:"system"`
External bool `json:"external"`
}
// ListDrives returns the home directory's volume on dev/preview hosts.
func ListDrives() []Drive {
home, err := os.UserHomeDir()
if err != nil {
return nil
}
free, _ := FreeGB(home)
return []Drive{{Root: home, FreeGB: free, System: true}}
}
// FreeGB is the free space on the volume holding path.
func FreeGB(path string) (float64, bool) {
var st syscall.Statfs_t
if err := syscall.Statfs(path, &st); err != nil {
return 0, false
}
return float64(st.Bavail) * float64(st.Bsize) / (1 << 30), true
}