unreal

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 14 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 (
	Platform_Windows = "Win64"
)
View Source
const (
	UnrealBuildFileExtension = ".build.cs"
)

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 File

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

File represents a file within an Unreal project.

func (*File) Exists

func (uf *File) Exists() bool

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

func (*File) ModTime

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

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

func (*File) ModulePath added in v0.1.1

func (uf *File) ModulePath() string

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

func (*File) Name

func (uf *File) Name() string

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

func (*File) String

func (uf *File) String() string

type Module

type Module struct {
	Name      string
	BaseDir   string
	BuildFile string
	Files     []string
	// contains filtered or unexported fields
}

Module represents an unreal module.

func (*Module) Contains

func (m *Module) 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 (*Module) LoadUHTFiles added in v0.1.3

func (m *Module) LoadUHTFiles(platform Platform, reload bool) ([]string, error)

LoadUHTFiles makes this module load the UHT files associated with this module for this platform. |reload| forces the previous cached results to be overwritten. Otherwise the previous results will be returned.

func (*Module) String

func (m *Module) String() string

type Platform

type Platform string

func NewUnrealPlatform

func NewUnrealPlatform(id string) (Platform, error)

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

func (*Platform) String

func (up *Platform) String() string

type Project

type Project struct {
	ProjectDir string
	Modules    map[string]*Module
}

Project represents an indexed Unreal project.

func IndexProject

func IndexProject(ctx context.Context, projectDir string) (*Project, error)

func (*Project) NewFile

func (p *Project) NewFile(path string) (*File, error)

func (*Project) SearchForFilesByExtension

func (p *Project) SearchForFilesByExtension(ctx context.Context, platform Platform, extensions []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. |extensions| should match a string.HasSuffix over the filepath.Base.

Jump to

Keyboard shortcuts

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