Files
soft_quay/app-win7/platform/windows/platform.go
T

39 lines
1.2 KiB
Go
Raw Normal View History

package windows
2026-07-19 21:10:59 +08:00
import (
2026-07-19 21:39:33 +08:00
"context"
2026-07-19 21:10:59 +08:00
"errors"
2026-07-19 21:39:33 +08:00
"time"
2026-07-19 21:10:59 +08:00
"softbox.local/core/application/launch"
2026-07-19 22:00:38 +08:00
"softbox.local/core/updater"
2026-07-19 21:10:59 +08:00
)
// Edition identifies the application build channel shown by the UI.
type Edition string
const EditionLegacy Edition = "Legacy"
2026-07-19 21:10:59 +08:00
// ErrUnsupported reports that a Windows-only capability is unavailable on the
// current host. Callers must treat it as an unknown state, never as a stopped
// process or a compatible system.
var ErrUnsupported = errors.New("windows platform capability is unsupported on this host")
// Platform is the minimal boundary for target-specific capabilities.
type Platform interface {
OS() string
Edition() Edition
2026-07-19 21:10:59 +08:00
IsCompatible(minOS string) (bool, error)
IsRunning(appID, entrypoint string) (bool, error)
2026-07-19 21:39:33 +08:00
WaitForExit(ctx context.Context, appID, entrypoint string, timeout time.Duration) error
2026-07-19 21:10:59 +08:00
Start(command launch.Command) (int, error)
2026-07-19 22:00:38 +08:00
WaitForProcessExit(ctx context.Context, pid int, timeout time.Duration) error
StartSelfUpdate(command updater.StartCommand) (int, error)
SyncDirectory(path string) error
}
// New returns the platform implementation selected by build tags.
func New() Platform {
return newPlatform()
}