Skip to content

package asset_info

import "kaiju/assets/asset_info"

Constants

InfoExtension

".adi"

ProjectCache

".cache"

Variables

ErrNoInfo

errors.New("asset database does not have info for this file")

Functions

Exists

func Exists(path string) bool

Exists checks to see if a given path has a generated ADI file the file it searches for will be path/to/file.ext.adi

ID

func ID(path string) (string, error)

ID returns the ID of the asset within it's ADI file, if the ADI file is not found, the read error is returned

InitForCurrentProject

func InitForCurrentProject() error

Move

func Move(info AssetDatabaseInfo, newPath string) error

Write

func Write(adi AssetDatabaseInfo) error

Types

AssetDatabaseInfo

struct

type AssetDatabaseInfo struct {
    ID       string
    Path     string
    Type     string
    ParentID string
    Children []AssetDatabaseInfo
    Metadata map[string]string
}

Lookup

func Lookup(id string) (AssetDatabaseInfo, error)

New

func New(path string, id string) AssetDatabaseInfo

Read

func Read(path string) (AssetDatabaseInfo, error)

Read will read the ADI file for the given path and return the AssetDatabaseInfo struct. Possible errors are:

  • ErrNoInfo: if the file does not exist
  • json.Unmarshal error: if the file is corrupted
  • filesystem.ReadTextFile error: if the file cannot be read

AssetDatabaseInfo.MetaValue

func (a *AssetDatabaseInfo) MetaValue(key string) string

AssetDatabaseInfo.SpawnChild

func (a *AssetDatabaseInfo) SpawnChild(id string) AssetDatabaseInfo