steamfolder

package module
v0.0.0-...-43af894 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 10 Imported by: 0

README

steamfolder

Library to work with a local Steam installation.

Documentation

Overview

Package steamfolder is a library to work with a local Steam installation.

It provides types and functions to locate Steam, parse its library and library folders, list and find apps.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSteamNotFound          = errors.New("Steam not found")
	ErrInvalidSteamInstallDir = errors.New("Steam install path exists but is not a directory")
)

Functions

This section is empty.

Types

type AppManifest

type AppManifest struct {
	// ID
	AppID steamlib.AppID
	// Name
	Name string
	// Install dir
	InstallDir string
	// Absolute install dir
	AbsInstallDir string
	// Size (in bytes)
	Size uint64
}

AppManifest represents a parsed `appmanifest_*.acf` file inside a library folder.

func NewAppManifest

func NewAppManifest(folder *LibraryFolder, appID steamlib.AppID) (*AppManifest, error)

NewAppManifest parses an AppManifest in a given `folder` for the given `appID`.

func ParseAppManifest

func ParseAppManifest(path string) (*AppManifest, error)

ParseAppManifest parses an app manifest at the given `path`.

type Library

type Library struct {
	// List of library folders
	Folders []*LibraryFolder
	// contains filtered or unexported fields
}

Library represents a parsed `libraryfolders.vdf` file.

func NewLibrary

func NewLibrary(steamDir string) (*Library, error)

NewLibrary parses a Library found in a given `steamDir` directory.

func ParseLibrary

func ParseLibrary(path string) (*Library, error)

ParseLibrary parses a `libraryfolders.vdf` file at the given `path`.

func (*Library) FindApp

func (l *Library) FindApp(appID steamlib.AppID) (*LibraryFolder, *AppManifest, error)

FindApp finds and parses the app manifest for the given `appID`, returning the folder in which the app was found and the parsed manifest.

It returns `(nil, nil, nil)` if the given `appID` was not found.

type LibraryFolder

type LibraryFolder struct {
	// Absolute path
	Path string
	// Label
	Label string
	// Total size (in bytes)
	TotalSize uint64
	// List of app IDs (sorted)
	Apps []steamlib.AppID
}

LibraryFolder represents a library folder entry in a `libraryfolders.vdf` file.

func (*LibraryFolder) ContainsApp

func (f *LibraryFolder) ContainsApp(appID steamlib.AppID) bool

ContainsApp returns true if this LibraryFolder contains the given `appID`.

func (*LibraryFolder) ParseAppManifest

func (f *LibraryFolder) ParseAppManifest(appID steamlib.AppID) (*AppManifest, error)

ParseAppManifest parses the AppManifest for the given `appID`.

type Steam

type Steam struct {
	// Install directory
	Path string
}

Steam represents a Steam installation.

func FindSteam

func FindSteam() (*Steam, error)

FindSteam tries to find an Steam installation directory.

It returns error `ErrSteamNotFound` if it did not find a suitable directory.

func NewSteam

func NewSteam(path string) *Steam

NewSteam creates a new Steam instance with the given `path`.

func (*Steam) Library

func (s *Steam) Library() (*Library, error)

Library parses the Steam library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL