Documentation
¶
Index ¶
- Constants
- func FixPermissions(v *Verdict, params FixPermissionsParams) ([]string, error)
- func HasSuspiciouslySetupLikeName(name string) bool
- type Arch
- type BlacklistEntry
- type Candidate
- type CandidateDetector
- type ConfigureParams
- type DetectResult
- type FilterParams
- type FixPermissionsParams
- type Flavor
- type HighestScoreFirst
- type JarInfo
- type LinuxInfo
- type LoveInfo
- type MacosInfo
- type Penalty
- type PenaltyKind
- type ScoredCandidate
- type ScriptInfo
- type Verdict
- type VerdictStats
- type WindowsInfo
- type WindowsInstallerType
Constants ¶
const ( PenaltyExclude = iota PenaltyScore )
Variables ¶
This section is empty.
Functions ¶
func FixPermissions ¶
func FixPermissions(v *Verdict, params FixPermissionsParams) ([]string, error)
FixPermissions makes sure all ELF executables, COFF executables, and scripts have the executable bit set
Types ¶
type BlacklistEntry ¶
type BlacklistEntry struct {
// contains filtered or unexported fields
}
type Candidate ¶
type Candidate struct {
// Path is relative to the configured folder
Path string `json:"path"`
// Mode describes file permissions
Mode uint32 `json:"mode,omitempty"`
// Depth is the number of path elements leading up to this candidate
Depth int `json:"depth"`
// Flavor is the type of a candidate - native, html, jar etc.
Flavor Flavor `json:"flavor"`
// Arch describes the architecture of a candidate (where relevant)
Arch Arch `json:"arch,omitempty"`
// Size is the size of the candidate's file, in bytes
Size int64 `json:"size"`
// Spell contains raw output from <https://github.com/itchio/wizardry>
// @optional
Spell []string `json:"spell,omitempty"`
// WindowsInfo contains information specific to native Windows candidates
// @optional
WindowsInfo *WindowsInfo `json:"windowsInfo,omitempty"`
// LinuxInfo contains information specific to native Linux candidates
// @optional
LinuxInfo *LinuxInfo `json:"linuxInfo,omitempty"`
// MacosInfo contains information specific to native macOS candidates
// @optional
MacosInfo *MacosInfo `json:"macosInfo,omitempty"`
// LoveInfo contains information specific to Love2D bundles (`.love` files)
// @optional
LoveInfo *LoveInfo `json:"loveInfo,omitempty"`
// ScriptInfo contains information specific to shell scripts (`.sh`, `.bat` etc.)
// @optional
ScriptInfo *ScriptInfo `json:"scriptInfo,omitempty"`
// JarInfo contains information specific to Java archives (`.jar` files)
// @optional
JarInfo *JarInfo `json:"jarInfo,omitempty"`
// Any other info.
Metadata interface{}
}
A Candidate is a potentially interesting launch target, be it a native executable, a Java or Love2D bundle, an HTML index, etc.
type CandidateDetector ¶
type ConfigureParams ¶
type ConfigureParams struct {
Consumer *state.Consumer
// filter to use when walking the install folder a nil value will fallback
// on lake's presets (not git/hg/svn metadata, no windows/mac metadata, no
// .itch folder)
Filter tlc.FilterFunc
Stats *VerdictStats
CandidateDetector
}
ConfigureParams controls the behavior of Configure
type DetectResult ¶
type FilterParams ¶
type FixPermissionsParams ¶
type Flavor ¶
type Flavor string
Flavor describes whether we're dealing with a native executables, a Java archive, a love2d bundle, etc.
const ( // FlavorNativeLinux denotes native linux executables FlavorNativeLinux Flavor = "linux" // ExecNativeMacos denotes native macOS executables FlavorNativeMacos Flavor = "macos" // FlavorPe denotes native windows executables FlavorNativeWindows Flavor = "windows" // FlavorAppMacos denotes a macOS app bundle FlavorAppMacos Flavor = "app-macos" // FlavorScript denotes scripts starting with a shebang (#!) FlavorScript Flavor = "script" // FlavorScriptWindows denotes windows scripts (.bat or .cmd) FlavorScriptWindows Flavor = "windows-script" // FlavorJar denotes a .jar archive with a Main-Class FlavorJar Flavor = "jar" // FlavorHTML denotes an index html file FlavorHTML Flavor = "html" // FlavorLove denotes a love package FlavorLove Flavor = "love" // Microsoft installer packages FlavorMSI Flavor = "msi" )
type HighestScoreFirst ¶
type HighestScoreFirst struct {
// contains filtered or unexported fields
}
func (*HighestScoreFirst) Len ¶
func (hsf *HighestScoreFirst) Len() int
func (*HighestScoreFirst) Less ¶
func (hsf *HighestScoreFirst) Less(i, j int) bool
func (*HighestScoreFirst) Swap ¶
func (hsf *HighestScoreFirst) Swap(i, j int)
type JarInfo ¶
type JarInfo struct {
// The main Java class as specified by the manifest included in the .jar (if any)
// @optional
MainClass string `json:"mainClass,omitempty"`
}
Contains information specific to Java archives
type LinuxInfo ¶
type LinuxInfo struct {
}
Contains information specific to native Linux executables
type LoveInfo ¶
type LoveInfo struct {
// The version of love2D required to open this bundle. May be empty
// @optional
Version string `json:"version,omitempty"`
}
Contains information specific to Love2D bundles
type MacosInfo ¶
type MacosInfo struct {
}
Contains information specific to native macOS executables or app bundles.
type PenaltyKind ¶
type PenaltyKind int
type ScoredCandidate ¶
type ScoredCandidate struct {
// contains filtered or unexported fields
}
type ScriptInfo ¶
type ScriptInfo struct {
// Something like `/bin/bash`
// @optional
Interpreter string `json:"interpreter,omitempty"`
}
Contains information specific to shell scripts
type Verdict ¶
type Verdict struct {
// BasePath is the absolute path of the folder that was configured
BasePath string `json:"basePath"`
// TotalSize is the size in bytes of the folder and all its children, recursively
TotalSize int64 `json:"totalSize"`
// Candidates is a list of potentially interesting files, with a lot of additional info
Candidates []*Candidate `json:"candidates"`
}
A Verdict contains a wealth of information on how to "launch" or "open" a specific folder.
func Configure ¶
func Configure(root string, params ConfigureParams) (*Verdict, error)
Configure walks a directory and finds potential launch candidates, grouped together into a verdict.
type VerdictStats ¶
type WindowsInfo ¶
type WindowsInfo struct {
// Particular type of installer (msi, inno, etc.)
// @optional
InstallerType WindowsInstallerType `json:"installerType,omitempty"`
// True if we suspect this might be an uninstaller rather than an installer
// @optional
Uninstaller bool `json:"uninstaller,omitempty"`
// Is this executable marked as GUI? This can be false and still pop a GUI, it's just a hint.
// @optional
Gui bool `json:"gui,omitempty"`
// Is this a .NET assembly?
// @optional
DotNet bool `json:"dotNet,omitempty"`
}
Contains information specific to native windows executables or installer packages.
type WindowsInstallerType ¶
type WindowsInstallerType string
Which particular type of windows-specific installer
const ( // Microsoft install packages (`.msi` files) WindowsInstallerTypeMsi WindowsInstallerType = "msi" // InnoSetup installers WindowsInstallerTypeInno WindowsInstallerType = "inno" // NSIS installers WindowsInstallerTypeNullsoft WindowsInstallerType = "nsis" // Self-extracting installers that 7-zip knows how to extract WindowsInstallerTypeArchive WindowsInstallerType = "archive" )