steamutils is a Go package for reading and parsing Steam application installation data. It provides cross-platform support for Windows, Linux, and macOS.
CAUTION: This code was generated by an LLM. It has not been thoroughly tested or verified for production use. Please use with caution and verify behavior in your specific use case before deployment.
go get github.com/bomkz/steamutils
- Detect Steam installation path on Windows, Linux, and macOS
- Parse Steam library folders configuration
- Read application manifest files
- Extract installed app metadata including name, build ID, size, and depots
- Support for custom Steam paths and library locations
- Cross-platform path handling
package main
import (
"log"
"github.com/bomkz/steamutils"
)
func main() {
reader, err := steamutils.NewSteamReader(steamutils.SteamReaderConfig{})
if err != nil {
log.Fatal(err)
}
// Get all installed applications
apps, err := reader.GetAllInstalledApps()
if err != nil {
log.Fatal(err)
}
for _, app := range apps {
log.Printf("App ID: %s, Name: %s, Size: %d bytes",
app.AppID, app.Name, app.SizeOnDisk)
}
}Create a SteamReader with default settings:
reader, err := steamutils.NewSteamReader(steamutils.SteamReaderConfig{})With custom Steam path:
config := steamutils.SteamReaderConfig{
CustomSteamPath: "/path/to/steam",
}
reader, err := steamutils.NewSteamReader(config)Get all installed applications:
apps, err := reader.GetAllInstalledApps()Get a specific application by app ID:
app, err := reader.GetInstalledAppByID("667970")
if err != nil {
log.Fatal(err)
}
log.Printf("%s: %s", app.AppID, app.Name)Find the library path containing an app:
path, err := reader.FindAppIDPath("667970")Get the build ID for an app:
buildID, err := reader.FindAppIDBuildID("667970")Provides methods to query Steam installation data.
Configuration for SteamReader:
- LibraryVdfPathFinder: Custom function to find libraryfolders.vdf path
- SteamPathFinder: Custom function to detect Steam installation path
- CustomLibraryVdfPath: Override library VDF file location
- CustomSteamPath: Override Steam installation path
- FormatSteamPath: Normalize Steam path formatting (applies path normalization rules)
Represents a Steam application:
- AppID: Unique application identifier
- Name: Display name
- InstallDir: Installation directory name
- FullPath: Full path to installation directory
- BuildID: Build version identifier
- SizeOnDisk: Size in bytes
- LastUpdated: Last update timestamp
- LastPlayed: Last play timestamp (0 if never played)
- LibraryPath: Path to the library containing this app
- InstalledDepots: List of content depots installed for this app
Represents a Steam depot (game content or DLC):
- DepotID: Unique depot identifier
- Manifest: Content manifest identifier
- Size: Depot size in bytes
- DLCAppID: Application ID if this is DLC content (empty for base game)
Windows: Detects Steam from Windows Registry
Linux: Checks standard Steam installation paths including:
- ~/.steam/steam
- ~/.local/share/Steam
- Flatpak installation paths
- Snap installation paths
macOS: Checks standard macOS Steam installation paths:
- ~/Library/Application Support/Steam
- Homebrew Cask installation paths
The package includes a VDF (Valve Data Format) parser for reading Steam configuration files. The Unmarshal function parses VDF data into ordered maps.
data, _ := os.ReadFile("libraryfolders.vdf")
parsed, err := steamutils.Unmarshal(data)IMPORTANT: This code was generated by an LLM and comes with the following caveats:
- Not thoroughly tested across all Steam configurations
- May not handle all VDF file variations
- Error handling may not cover all edge cases
- Performance not optimized for large Steam libraries
- Registry access on Windows may require appropriate permissions
- File I/O operations use standard Go libraries without retry logic
- Cross-platform testing is recommended before production use
Run the test suite:
go test ./...
Run tests with verbose output:
go test ./... -v
Run specific test:
go test -run TestGetSteamPath ./...
The package returns errors for common failure cases:
- Steam installation not found
- Library configuration file not accessible
- Application manifest file missing or corrupted
- VDF parsing errors
Check error values before using returned data:
app, err := reader.GetInstalledAppByID("999999")
if err != nil {
log.Printf("Failed to get app: %v", err)
return
}This is an LLM-generated project. If you discover issues or want to contribute improvements, please be aware that thorough testing and verification is essential.
This software is released into the public domain under the Unlicense. See LICENSE file for details.
This package was generated by an LLM. It should be thoroughly tested and verified before use in any production environment. The authors are not responsible for any data loss, application crashes, or other issues that may arise from the use of this package.