fs

package
v0.0.0-...-9febfc8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package fs provides representation of GN input files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizePath

func NormalizePath(path string) string

NormalizePath collapses "." and sequential "/"s and evaluates "..". |path| may be system-absolute, source-absolute, or relative. |path| will retain its relativity, use NormalizePathWithSourceRoot if a different source root is desired.

func NormalizePathWithSourceRoot

func NormalizePathWithSourceRoot(path, sourceRoot string) string

NormalizePathWithSourceRoot is same as NormalizePath, but if |path| is source-absolute and |sourceRoot| is non-empty, |path| may be system absolute after this function returns, if |path| references the filesystem outside of |sourceRoot| (ex. path = "//.."). In this case on Windows, |path| will have a leading slash. Otherwise, |path| will retain its relativity. |sourceRoot| must not end with a slash.

Types

type InputFile

type InputFile struct {
	// Name is the virtual name for representing this file. This does not take into
	// account whether the file was loaded from the secondary source tree (see
	// BuildSettings secondarySourcePath).
	Name SourceFile
	// contains filtered or unexported fields
}

InputFile represents a lazy-loadable file.

func NewInputFile

func NewInputFile(name, path string) (*InputFile, error)

NewInputFile creates an input file from provided path.

func (InputFile) Contents

func (f InputFile) Contents() string

Contents represents contents of the file.

type SourceFile

type SourceFile struct {
	// contains filtered or unexported fields
}

SourceFile represents a file within the source tree. Always begins in a slash, never ends in one.

func (SourceFile) Filename

func (s SourceFile) Filename() string

Filename returns the source file name.

Jump to

Keyboard shortcuts

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