Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

steamutils

Go Reference

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.

Installation

go get github.com/bomkz/steamutils

Features

  • 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

Quick Start

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)
	}
}

Usage

Creating a SteamReader

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)

Retrieving Applications

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)

Querying Paths

Find the library path containing an app:

path, err := reader.FindAppIDPath("667970")

Get the build ID for an app:

buildID, err := reader.FindAppIDBuildID("667970")

Types

SteamReader

Provides methods to query Steam installation data.

SteamReaderConfig

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)

InstalledApp

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

InstalledDepot

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)

Platform Support

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

VDF File Format

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)

Limitations and Warnings

IMPORTANT: This code was generated by an LLM and comes with the following caveats:

  1. Not thoroughly tested across all Steam configurations
  2. May not handle all VDF file variations
  3. Error handling may not cover all edge cases
  4. Performance not optimized for large Steam libraries
  5. Registry access on Windows may require appropriate permissions
  6. File I/O operations use standard Go libraries without retry logic
  7. Cross-platform testing is recommended before production use

Testing

Run the test suite:

go test ./...

Run tests with verbose output:

go test ./... -v

Run specific test:

go test -run TestGetSteamPath ./...

Error Handling

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
}

Contributing

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.

License

This software is released into the public domain under the Unlicense. See LICENSE file for details.

Disclaimer

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

⌂ 换网址