Documentation
¶
Overview ¶
Package steamutils provides utilities for reading Steam application installation data.
CAUTION: This package was generated by an LLM. It has not been thoroughly tested or verified for production use. Use with caution and verify behavior before deploying to production.
The package supports Windows, Linux, and macOS platforms and can:
- Detect Steam installation paths
- Parse Steam library configuration files
- Read application manifest files
- Extract installed application metadata
- Handle custom Steam paths and configurations
Basic usage:
reader, err := NewSteamReader(SteamReaderConfig{})
if err != nil {
log.Fatal(err)
}
apps, err := reader.GetAllInstalledApps()
To specify a custom Steam path:
config := SteamReaderConfig{
CustomSteamPath: "/custom/steam/path",
}
reader, err := NewSteamReader(config)
On Windows, Steam path is detected from the registry. On Linux and macOS, standard installation paths are checked. Custom paths can be provided via SteamReaderConfig.
Index ¶
- func GetAutoLoggedInSteamUsername() (string, error)
- func GetSteamPath() (string, error)
- func Marshal(m *orderedmap.OrderedMap) ([]byte, error)
- func Unmarshal(data []byte) (*orderedmap.OrderedMap, error)
- type InstalledApp
- type InstalledDepot
- type SteamReader
- func (steamreader *SteamReader) FindAppIDBuildID(AppID string) (buildId string, err error)
- func (steamreader *SteamReader) FindAppIDPath(targetAppID string) (string, error)
- func (steamreader *SteamReader) GetAllInstalledApps() ([]InstalledApp, error)
- func (steamreader *SteamReader) GetInstalledAppByID(appID string) (*InstalledApp, error)
- func (steamreader *SteamReader) GetLibraryVdfMap() *orderedmap.OrderedMap
- func (steamreader *SteamReader) GetLibraryVdfPath() string
- func (steamreader *SteamReader) GetSteamPath() string
- type SteamReaderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAutoLoggedInSteamUsername ¶
GetAutoLoggedInSteamUsername returns Steam username on Linux This is less reliable than Windows but attempts to find it
func GetSteamPath ¶
GetSteamPath finds Steam's installation path on Linux Checks multiple common locations in order of likelihood
func Marshal ¶
func Marshal(m *orderedmap.OrderedMap) ([]byte, error)
func Unmarshal ¶
func Unmarshal(data []byte) (*orderedmap.OrderedMap, error)
Parses and unmarshals VDF file into map
Types ¶
type InstalledApp ¶
type InstalledApp struct {
// AppID is the unique Steam application identifier.
AppID string
// Name is the display name of the application.
Name string
// InstallDir is the installation directory name (relative to steamapps/common).
InstallDir string
// FullPath is the complete filesystem path to the application directory.
FullPath string
// BuildID is the build version identifier.
BuildID string
// SizeOnDisk is the total installation size in bytes.
SizeOnDisk int64
// LastUpdated is the Unix timestamp of the last update.
LastUpdated int64
// LastPlayed is the Unix timestamp of the last play session.
// Zero value indicates the application has never been played.
LastPlayed int64
// LibraryPath is the path to the Steam library containing this application.
LibraryPath string
// InstalledDepots is the list of content depots installed for this application.
InstalledDepots []InstalledDepot
}
InstalledApp represents a Steam application with its installation details.
This type contains metadata about an installed game or application, including basic information, file locations, timestamps, and associated content depots.
WARNING: This type was generated by an LLM. Thoroughly test before production use.
type InstalledDepot ¶
type InstalledDepot struct {
// DepotID is the unique identifier for this depot.
DepotID string
// Manifest is the content manifest identifier for this depot version.
Manifest string
// Size is the total size of the depot in bytes.
Size int64
// DLCAppID contains the application ID if this depot is DLC content.
// Empty string for base game depots.
DLCAppID string
}
InstalledDepot represents a Steam depot (content package) installed for an application.
A depot is a container for game content. Most applications have one base game depot. DLC content is represented as separate depots with a DLCAppID value.
WARNING: This type was generated by an LLM. Thoroughly test before production use.
type SteamReader ¶
type SteamReader struct {
SteamReaderConfig SteamReaderConfig
// contains filtered or unexported fields
}
SteamReader provides methods to query Steam installation and application data.
It reads and parses Steam's libraryfolders.vdf configuration file and application manifest files to extract metadata about installed applications and depots.
WARNING: This type was generated by an LLM. Thoroughly test before production use.
func NewSteamReader ¶
func NewSteamReader(steamReaderConfig SteamReaderConfig) (steamreader SteamReader, err error)
NewSteamReader creates a new SteamReader with the provided configuration.
The function automatically detects the Steam installation path and library configuration unless custom paths are provided in SteamReaderConfig.
On Windows, the registry (HKEY_CURRENT_USER\Software\Valve\Steam) is checked. On Linux and macOS, standard installation paths are checked in order of likelihood.
Returns an error if Steam cannot be located or if libraryfolders.vdf cannot be read.
WARNING: This function was generated by an LLM. Thoroughly test before production use.
func (*SteamReader) FindAppIDBuildID ¶
func (steamreader *SteamReader) FindAppIDBuildID(AppID string) (buildId string, err error)
FindAppIDBuildID returns the build ID for the specified application.
It locates the application in the library configuration and reads the appmanifest file to extract the build ID. Returns an error if the application is not found or the manifest file cannot be read.
func (*SteamReader) FindAppIDPath ¶
func (steamreader *SteamReader) FindAppIDPath(targetAppID string) (string, error)
FindAppIDPath returns the Steam library path containing the specified application.
It searches through all configured library folders to find the application ID. Returns the library directory path where the application is installed. Returns an error if the application is not found in any library.
func (*SteamReader) GetAllInstalledApps ¶
func (steamreader *SteamReader) GetAllInstalledApps() ([]InstalledApp, error)
GetAllInstalledApps returns a list of all installed Steam applications by reading appmanifest_<appid>.acf files from all Steam library folders.
It iterates through all configured library locations and scans for installed applications. Returns a slice of InstalledApp with full metadata including name, size, build ID, and installed content depots.
Returns an error if the library configuration cannot be parsed or if manifest files cannot be read. Applications with unreadable manifest files are skipped.
WARNING: This method was generated by an LLM. Thoroughly test before production use.
func (*SteamReader) GetInstalledAppByID ¶
func (steamreader *SteamReader) GetInstalledAppByID(appID string) (*InstalledApp, error)
GetInstalledAppByID retrieves details for a specific installed app by its AppID.
It searches all configured library folders to locate the application and reads its manifest file to extract metadata. Returns a pointer to InstalledApp with all available information including name, size, build ID, and installed depots.
Returns an error if the application is not found in any library or if the manifest file cannot be read.
WARNING: This method was generated by an LLM. Thoroughly test before production use.
func (*SteamReader) GetLibraryVdfMap ¶
func (steamreader *SteamReader) GetLibraryVdfMap() *orderedmap.OrderedMap
GetLibraryVdfMap returns the parsed library configuration data as an OrderedMap.
The returned map contains the structure of libraryfolders.vdf with library entries indexed by key (typically "0", "1", etc.).
func (*SteamReader) GetLibraryVdfPath ¶
func (steamreader *SteamReader) GetLibraryVdfPath() string
GetLibraryVdfPath returns the path to the libraryfolders.vdf configuration file.
This file is typically located in Steam's config directory and contains the list of library folders and their installed applications.
func (*SteamReader) GetSteamPath ¶
func (steamreader *SteamReader) GetSteamPath() string
GetSteamPath returns the Steam installation directory path.
If FormatSteamPath is enabled in SteamReaderConfig, the path is normalized with proper case handling and path separators. Returns the raw path otherwise.
type SteamReaderConfig ¶
type SteamReaderConfig struct {
// LibraryVdfPathFinder is a custom function to locate libraryfolders.vdf.
// If nil, the default implementation checks the Steam directory.
LibraryVdfPathFinder func(steamPath string) (string, error)
// SteamPathFinder is a custom function to detect the Steam installation path.
// If nil, platform-specific detection is used (registry on Windows, paths on Linux/macOS).
SteamPathFinder func() (string, error)
// CustomLibraryVdfPath overrides the detected libraryfolders.vdf path.
// If set, LibraryVdfPathFinder is not called.
CustomLibraryVdfPath string
// CustomSteamPath overrides the detected Steam installation path.
// If set, SteamPathFinder is not called.
CustomSteamPath string
// FormatSteamPath normalizes the Steam path formatting.
// Applies path separator normalization and case corrections.
// Only affects paths from the default SteamPathFinder.
FormatSteamPath bool
// UserName is used for Linux installations only, used to find steamPath
UserName string
// contains filtered or unexported fields
}
SteamReaderConfig provides configuration options for creating a new SteamReader.
LibraryVdfPathFinder and SteamPathFinder allow custom path detection logic. CustomLibraryVdfPath and CustomSteamPath override automatic detection. FormatSteamPath determines whether to normalize path formatting.
WARNING: This type was generated by an LLM. Thoroughly test before production use.