unreal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package unreal holds common functionality for querying an unreal project, searching for things like modules, files, etc.

Index

Constants

View Source
const (
	UnrealBuildFileExtension = ".build.cs"
)
View Source
const (
	UnrealPlatform_Windows = "Win64"
)

Variables

This section is empty.

Functions

func IsUnrealBuildFile

func IsUnrealBuildFile(path string) (string, bool, error)

IsUnrealBuildFile returns whether the path points to an unreal build file. These are normally C# files that end with the .Build.cs extension. We search for a common regex pattern than we should find. Returns the defined module name when found.

Types

type UnrealFile

type UnrealFile struct {
	Path         string
	Module       *UnrealModule
	FileInfo     fs.FileInfo
	Intermediate bool
}

UnrealFile represents a file within an Unreal project.

func (*UnrealFile) Exists

func (uf *UnrealFile) Exists() bool

Exists returns whether the given file exists in disk or not.

func (*UnrealFile) InternalPath

func (uf *UnrealFile) InternalPath() string

InternalPath is the path of the file _within_ the module (basically stripping the module path).

func (*UnrealFile) ModTime

func (uf *UnrealFile) ModTime() time.Time

ModTime returns the latest modification time of the file. If the file does not exist, returns the earliest time possible.

func (*UnrealFile) Name

func (uf *UnrealFile) Name() string

Name is just the filename of the file (akin to filepath.Base), without the extension.

func (*UnrealFile) String

func (uf *UnrealFile) String() string

type UnrealModule

type UnrealModule struct {
	Name      string
	BaseDir   string
	BuildFile string
	Files     []string
}

UnrealModule represents an unreal module.

func NewUnrealModule

func NewUnrealModule(name string, buildFile string, files []string) (*UnrealModule, error)

NewUnrealModule generates a new module definition from the path to its build file. Assumes that the entry path has been cleaned with filepath.Clean Name can be empty and will be taken from the name of the file.

func (*UnrealModule) Contains

func (um *UnrealModule) Contains(path string) bool

Contains returns whether a particular path is within this module. Assumes that the entry |path| has been cleaned with filepath.Clean

func (*UnrealModule) String

func (um *UnrealModule) String() string

type UnrealPlatform

type UnrealPlatform string

func NewUnrealPlatform

func NewUnrealPlatform(id string) (UnrealPlatform, error)

NewUnrealPlatform attempts to unify the unreal platform from identifiers that might come from the outside.

func (*UnrealPlatform) String

func (up *UnrealPlatform) String() string

type UnrealProject

type UnrealProject struct {
	ProjectDir string
	Modules    map[string]*UnrealModule
}

UnrealProject represets an indexed Unreal project.

func IndexUnrealProject

func IndexUnrealProject(ctx context.Context, projectDir string) (*UnrealProject, error)

func (*UnrealProject) NewUnrealFile

func (up *UnrealProject) NewUnrealFile(path string) (*UnrealFile, error)

func (*UnrealProject) SearchForFilesByExtension

func (up *UnrealProject) SearchForFilesByExtension(ctx context.Context, extension string) ([]string, error)

SearchForFilesByExtension goes over all the loaded modules in parallel and finds all the found files with that extension. Useful for things like finding all gochart files. |extension| should be akin to the result of a filepath.Ext call, which includes the dot.

Jump to

Keyboard shortcuts

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