Documentation
¶
Overview ¶
Package steam provides local Steam integration for shortcuts and artwork management.
Index ¶
- Variables
- func ConvertToShortcutInfo(cfg protocol.ShortcutConfig) protocol.ShortcutInfo
- func GenerateAppID(exe, name string) uint32
- func LoadShortcutsVDF(path string) ([]protocol.ShortcutInfo, error)
- func Uint32ToUserID(userID uint32) string
- func UserIDToUint32(userID string) (uint32, error)
- type ArtworkType
- type Paths
- func (p *Paths) ArtworkPath(userID string, appID uint32, artType ArtworkType, ext string) string
- func (p *Paths) BaseDir() string
- func (p *Paths) ConfigDir(userID string) string
- func (p *Paths) EnsureGridDir(userID string) error
- func (p *Paths) GridDir(userID string) string
- func (p *Paths) HasShortcuts(userID string) bool
- func (p *Paths) ShortcutsPath(userID string) string
- func (p *Paths) UserDataDir() string
- func (p *Paths) UserDir(userID string) string
- type ShortcutManager
- func (m *ShortcutManager) ArtworkPaths(userID string, appID uint32) map[ArtworkType]string
- func (m *ShortcutManager) DeleteArtwork(userID string, appID uint32) error
- func (m *ShortcutManager) EnsureGridDir(userID string) error
- func (m *ShortcutManager) FindExistingArtwork(userID string, appID uint32) (map[ArtworkType]string, error)
- func (m *ShortcutManager) GetGridDir(userID string) string
- func (m *ShortcutManager) GetShortcutsPath(userID string) string
- func (m *ShortcutManager) SaveArtwork(userID string, appID uint32, artType ArtworkType, data []byte, ext string) error
- type User
Constants ¶
This section is empty.
Variables ¶
var ( ErrSteamNotFound = errors.New("steam installation not found") ErrUserNotFound = errors.New("steam user not found") ErrImageNotFound = errors.New("image not found") ErrShortcutsNotFound = errors.New("shortcuts.vdf not found") )
Common errors for Steam operations.
Functions ¶
func ConvertToShortcutInfo ¶
func ConvertToShortcutInfo(cfg protocol.ShortcutConfig) protocol.ShortcutInfo
ConvertToShortcutInfo converts a protocol.ShortcutConfig to protocol.ShortcutInfo.
func GenerateAppID ¶
GenerateAppID generates a Steam shortcut app ID from executable path and name. This matches Steam's algorithm for non-Steam game shortcuts.
func LoadShortcutsVDF ¶ added in v0.3.0
func LoadShortcutsVDF(path string) ([]protocol.ShortcutInfo, error)
LoadShortcutsVDF parses a binary VDF shortcuts file and returns shortcut info. The binary VDF format uses type markers (\x00=object, \x01=string, \x02=int32, \x08=end).
func Uint32ToUserID ¶
Uint32ToUserID converts a uint32 user ID to string.
func UserIDToUint32 ¶
UserIDToUint32 converts a string user ID to uint32.
Types ¶
type ArtworkType ¶
type ArtworkType int
ArtworkType represents the type of Steam artwork.
const ( ArtworkGrid ArtworkType = iota // 460x215 horizontal banner ArtworkHero // 1920x620 header ArtworkLogo // transparent logo ArtworkIcon // square icon ArtworkPortrait // 600x900 vertical grid )
type Paths ¶
type Paths struct {
// contains filtered or unexported fields
}
Paths provides access to Steam directory paths.
func NewPathsWithBase ¶
NewPathsWithBase creates a new Paths instance with a custom base directory.
func (*Paths) ArtworkPath ¶
ArtworkPath returns the path for a specific artwork type.
func (*Paths) EnsureGridDir ¶
EnsureGridDir creates the grid directory if it doesn't exist.
func (*Paths) HasShortcuts ¶
HasShortcuts returns true if the user has a shortcuts.vdf file.
func (*Paths) ShortcutsPath ¶
ShortcutsPath returns the path to shortcuts.vdf for a user.
func (*Paths) UserDataDir ¶
UserDataDir returns the userdata directory.
type ShortcutManager ¶
type ShortcutManager struct {
// contains filtered or unexported fields
}
ShortcutManager handles Steam shortcut operations.
func NewShortcutManager ¶
func NewShortcutManager() (*ShortcutManager, error)
NewShortcutManager creates a new ShortcutManager.
func NewShortcutManagerWithPaths ¶
func NewShortcutManagerWithPaths(paths *Paths) *ShortcutManager
NewShortcutManagerWithPaths creates a ShortcutManager with custom paths.
func (*ShortcutManager) ArtworkPaths ¶
func (m *ShortcutManager) ArtworkPaths(userID string, appID uint32) map[ArtworkType]string
ArtworkPaths returns all artwork paths for a shortcut.
func (*ShortcutManager) DeleteArtwork ¶
func (m *ShortcutManager) DeleteArtwork(userID string, appID uint32) error
DeleteArtwork removes all artwork for an appID.
func (*ShortcutManager) EnsureGridDir ¶
func (m *ShortcutManager) EnsureGridDir(userID string) error
EnsureGridDir creates the grid directory if it doesn't exist.
func (*ShortcutManager) FindExistingArtwork ¶
func (m *ShortcutManager) FindExistingArtwork(userID string, appID uint32) (map[ArtworkType]string, error)
FindExistingArtwork finds existing artwork files for an appID.
func (*ShortcutManager) GetGridDir ¶
func (m *ShortcutManager) GetGridDir(userID string) string
GetGridDir returns the grid artwork directory for a user.
func (*ShortcutManager) GetShortcutsPath ¶
func (m *ShortcutManager) GetShortcutsPath(userID string) string
GetShortcutsPath returns the shortcuts.vdf path for a user.
func (*ShortcutManager) SaveArtwork ¶
func (m *ShortcutManager) SaveArtwork(userID string, appID uint32, artType ArtworkType, data []byte, ext string) error
SaveArtwork saves artwork data to the appropriate path.
type User ¶
User represents a Steam user with shortcuts.
func GetFirstUserWithShortcuts ¶
GetFirstUserWithShortcuts returns the first user that has shortcuts.
func GetUsersWithPaths ¶
GetUsersWithPaths returns users using the provided Paths instance.