Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigFilePath ¶
func ConfigFilePath() string
ConfigFilePath returns the full path to asset-config.json under the user's home directory. Initialised once on first call.
func DetectUnityDocsPath ¶ added in v0.0.10
func DetectUnityDocsPath() string
DetectUnityDocsPath probes the few well-known offline-docs locations and returns the first one that resolves to an existing directory containing the ScriptReference/ subfolder. Returns an empty string when nothing matched. The caller decides whether to persist the result (Set) or just use it for the current call.
func GetUnityDocsPath ¶ added in v0.0.10
GetUnityDocsPath reads the persisted offline-docs directory.
func SetUnityDocsPath ¶ added in v0.0.10
SetUnityDocsPath persists the offline-docs directory. Passing an empty string clears the field so the lookup falls back to env + autodetect.
Types ¶
type AssetConfig ¶
type AssetConfig struct {
Version string `json:"version"`
Assets []AssetEntry `json:"assets"`
// UnityDocsPath is the offline Unity Documentation directory used by the
// `unity_docs` tool (the `en/` folder under a standard download, holding
// ScriptReference/, Manual/, StaticFiles/). Empty string falls back to
// the env var and the autodetect probe at lookup time.
UnityDocsPath string `json:"unity_docs_path,omitempty"`
}
AssetConfig holds the full configuration.
func Load ¶
func Load() (*AssetConfig, error)
Load reads the asset config from disk. Returns defaults if file doesn't exist.
func SetAssetEnabled ¶
func SetAssetEnabled(id string, enabled bool) (*AssetConfig, error)
SetAssetEnabled sets the enabled state of an asset by ID.
func ToggleAsset ¶
func ToggleAsset(id string) (*AssetConfig, error)
ToggleAsset flips the enabled state of an asset by ID.
type AssetEntry ¶
type AssetEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Installed bool `json:"installed"`
Category string `json:"category"`
Description string `json:"description"`
DocURL string `json:"doc_url,omitempty"`
ReferencePath string `json:"reference_path,omitempty"`
}
AssetEntry represents a single asset plugin entry.
func DefaultAssets ¶
func DefaultAssets() []AssetEntry
DefaultAssets returns the built-in list of known asset plugins.
func GetEnabledAssets ¶
func GetEnabledAssets() ([]AssetEntry, error)
GetEnabledAssets returns all enabled asset entries.