Documentation
¶
Index ¶
- Constants
- Variables
- func AddRemapRule(ctx context.Context, db *sql.DB, q *dbq.Queries, itemID int64, ruleType string, ...) error
- func ClearRemapConfig(ctx context.Context, db *sql.DB, q *dbq.Queries, itemID int64, ...) error
- func CopyDeployRules(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, ...) error
- func CopyRemapConfig(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, ...) error
- func CopySkipBackupPatterns(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, ...) error
- func CopyWriteOncePatterns(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, ...) error
- func EnsureDBExists() error
- func EnsureRemapConfig(ctx context.Context, qtx *dbq.Queries, itemID int64) (int64, error)
- func FullSelector(storeID, storeGameID, instanceID string) string
- func GooseProvider(db *sql.DB) (*goose.Provider, error)
- func IsBinaryContent(data []byte) bool
- func IsUnderDir(path, dir string) (bool, error)
- func MigrateDB(ctx context.Context, db *sql.DB) error
- func ParseInt64(s string) (int64, bool)
- func ParseSelector(s string) (storeID, storeGameID, instanceID string, err error)
- func ResolveModFileVersionArg(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModFileVersionByIDRow, error)
- func ResolveModPageArg(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModPageByIDForGameRow, error)
- func ResolveProfileItemByVersion(ctx context.Context, profile *dbq.Profile, q *dbq.Queries, versionID int64) (int64, error)
- func RewriteProfilePriorities(ctx context.Context, qtx *dbq.Queries, profileID int64, ...) error
- func SetProfileItemEnabled(ctx context.Context, profile *dbq.Profile, q *dbq.Queries, versionID int64, ...) error
- func SetupDB() (*sql.DB, error)
- func SetupDBReadOnly() (*sql.DB, error)
- func ShortSelector(storeID, storeGameID, instanceID string) string
- func WalkUpdateChain(startFileID int64, next map[int64]int64) int64
- type RefreshResult
- type RefreshStyles
- type SqliteStore
Constants ¶
const DB_PRAGMAS = "?_foreign_keys=ON&_journal_mode=WAL&_synchronous=NORMAL"
Variables ¶
var Migrations embed.FS
Functions ¶
func AddRemapRule ¶
func AddRemapRule(ctx context.Context, db *sql.DB, q *dbq.Queries, itemID int64, ruleType string, intVal sql.NullInt64, textVal sql.NullString, overridePos int64) error
AddRemapRule adds a single remap rule to the config for a profile item, creating the config if it does not exist yet. The position is auto-assigned as MAX(position)+1 unless overridePos is >= 0.
func ClearRemapConfig ¶
func ClearRemapConfig(ctx context.Context, db *sql.DB, q *dbq.Queries, itemID int64, profileName string, versionID int64) error
ClearRemapConfig deletes all remap rules for a profile item's config and removes the config itself, leaving remap_config_id NULL on the profile item. No-op if the profile item has no remap config.
func CopyDeployRules ¶ added in v0.6.0
func CopyDeployRules(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, srcVersionID, dstVersionID int64, profileName string) error
CopyDeployRules copies skip-backup and write-once patterns from one profile item to another. If the destination already has patterns of either kind they are replaced. If the source has no patterns for a given kind that kind is a no-op. Returns the counts of patterns copied for each kind.
func CopyRemapConfig ¶
func CopyRemapConfig(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, srcVersionID, dstVersionID int64, profileName string) error
CopyRemapConfig copies remap rules from one profile item to another within the same profile. If the destination already has a config its rules are replaced. If the source has no config this is a no-op.
func CopySkipBackupPatterns ¶ added in v0.6.0
func CopySkipBackupPatterns(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, srcVersionID, dstVersionID int64, profileName string) error
CopySkipBackupPatterns copies skip-backup patterns from one profile item to another within the same profile. If the destination already has patterns they are replaced. If the source has no patterns this is a no-op.
func CopyWriteOncePatterns ¶ added in v0.6.0
func CopyWriteOncePatterns(ctx context.Context, db *sql.DB, q *dbq.Queries, srcItemID, dstItemID int64, srcVersionID, dstVersionID int64, profileName string) error
CopyWriteOncePatterns copies write-once patterns from one profile item to another within the same profile. If the destination already has patterns they are replaced. If the source has no patterns this is a no-op.
func EnsureDBExists ¶
func EnsureDBExists() error
EnsureDBExists verifies that the configured database file exists and is a regular file. If not, it returns a user-friendly error.
func EnsureRemapConfig ¶
EnsureRemapConfig returns the existing remap_config_id for a profile item, or creates a new one and links it to the profile item within the provided transaction if none exists yet.
func FullSelector ¶
FullSelector always includes the instance (even if it's "default").
Example: steam:1091500#default
func IsBinaryContent ¶ added in v0.6.0
IsBinaryContent reports whether data appears to be binary by scanning for null bytes in the first 8KB, matching the heuristic used by Git and other tools.
func IsUnderDir ¶
isUnderDir reports whether the given path resides within the directory dir.
Both path and dir are first converted to absolute paths to avoid surprises with relative paths. The function then computes the relative path from dir to path using filepath.Rel.
If the resulting relative path starts with "..", the path lies outside dir. Otherwise, it is considered inside dir (including the case where path == dir).
This avoids unsafe string-prefix checks such as:
strings.HasPrefix(path, dir)
which can produce false positives (e.g. "/foo/bar-baz" vs "/foo/bar") and does not correctly handle ".." traversal.
The function does not resolve symlinks. If symlink-aware containment checks are required, both paths should be resolved via filepath.EvalSymlinks first.
func ParseInt64 ¶
func ParseSelector ¶
ParseSelector parses either: - store:game - store:game#instance
If instance is omitted, it returns instanceID="default".
func ResolveModFileVersionArg ¶
func ResolveModFileVersionArg(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModFileVersionByIDRow, error)
ResolveModFileVersionArg resolves a mod file version argument for the given game install. Accepts:
- a numeric ID (fast path, unambiguous)
- a mod page name (case-insensitive; errors if ambiguous, listing all candidates with their numeric IDs)
func ResolveModPageArg ¶
func ResolveModPageArg(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModPageByIDForGameRow, error)
ResolveModPageArg resolves a mod page argument for the given game install. Accepts:
- a numeric ID (fast path, unambiguous)
- a mod page name (case-insensitive; errors if ambiguous, listing all candidates with their numeric IDs)
func ResolveProfileItemByVersion ¶
func ResolveProfileItemByVersion(ctx context.Context, profile *dbq.Profile, q *dbq.Queries, versionID int64) (int64, error)
ResolveProfileItemByVersion looks up a profile item by mod file version ID within a profile, returning a clean error if the version is not in the profile.
func RewriteProfilePriorities ¶
func RewriteProfilePriorities( ctx context.Context, qtx *dbq.Queries, profileID int64, items []dbq.ListProfileItemsForOrderRow, start, step int64, ) error
RewriteProfilePriorities rewrites priorities for the given ordered items.
It is safe under UNIQUE(profile_id, priority) because it first shifts all existing priorities out of the way by an offset, then assigns final values.
start is the first priority value to assign (for compact: 1). step is the increment between consecutive priorities (for compact: 1; for --multiple N: N).
func SetProfileItemEnabled ¶
func SetupDBReadOnly ¶
func ShortSelector ¶
ShortSelector includes the instance only if it isn't "default".
Example: steam:1091500 Example: steam:1091500#library_2
Types ¶
type RefreshResult ¶ added in v0.2.0
type RefreshResult struct {
New []string // display names of newly discovered installs
Updated []string // display names of installs seen again (already present)
Returned []string // display names of installs that were missing and came back
Missing []string // display names of installs that disappeared
Skipped []string // display names of installs that were filtered out
Warnings []string
}
func ScanStores ¶
func ScanStores(ctx context.Context, db *sql.DB, styles RefreshStyles) (RefreshResult, error)
type RefreshStyles ¶ added in v0.2.0
type SqliteStore ¶ added in v0.2.0
A custom goose store to let us override the schema migrations table to use more idiomatic sqlite
func (*SqliteStore) CreateVersionTable ¶ added in v0.2.0
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package extractor handles extraction of mod archives to a staging directory and deployment of files into the game target directory.
|
Package extractor handles extraction of mod archives to a staging directory and deployment of files into the game target directory. |
|
Package lock provides per-game-install exclusive locking for apply and unapply operations.
|
Package lock provides per-game-install exclusive locking for apply and unapply operations. |
|
Package patchapply applies structured patch entries to ini, yaml, and json files.
|
Package patchapply applies structured patch entries to ini, yaml, and json files. |
|
Package planner computes the desired file state for a profile apply or unapply.
|
Package planner computes the desired file state for a profile apply or unapply. |
|
Package remap implements the remap rule engine for modctl.
|
Package remap implements the remap rule engine for modctl. |