Add standalone desktop workflow

This commit is contained in:
2026-04-24 11:54:33 +03:00
parent 75c6b928ae
commit 50246ada85
20 changed files with 1068 additions and 306 deletions

View File

@@ -5,7 +5,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"github.com/google/uuid"
)
@@ -59,30 +58,6 @@ func Probe(mountPath string) (DiskInfo, error) {
return info, nil
}
func IsMountPoint(path string) bool {
pathInfo, err := os.Stat(path)
if err != nil {
return false
}
parent := filepath.Dir(filepath.Clean(path))
parentInfo, err := os.Stat(parent)
if err != nil {
return false
}
pathStat, ok := pathInfo.Sys().(*syscall.Stat_t)
if !ok {
return false
}
parentStat, ok := parentInfo.Sys().(*syscall.Stat_t)
if !ok {
return false
}
return pathStat.Dev != parentStat.Dev
}
func CheckWritable(path string) error {
f, err := os.CreateTemp(path, ".jukebox-writecheck-*")
if err != nil {
@@ -112,13 +87,3 @@ func InitDisk(mountPath string) (string, error) {
func DBPath(mountPath string) string {
return filepath.Join(mountPath, MarkerDir, "history.db")
}
func DiskUsage(mountPath string) (total, free int64, err error) {
var stat syscall.Statfs_t
if err = syscall.Statfs(mountPath, &stat); err != nil {
return 0, 0, err
}
total = int64(stat.Blocks) * int64(stat.Bsize)
free = int64(stat.Bavail) * int64(stat.Bsize)
return total, free, nil
}