Documentation
¶
Index ¶
- func Arch() string
- func CreateJunctions(junctions ...[2]string) error
- func CreateShortcuts(shortcuts ...Shortcut) error
- func ExtractDir(dirToExtract, destinationDir string) error
- func ForceRemoveAll(path string) error
- func GetDirFilenames(dir string) ([]string, error)
- func GetFolderPath(folderType string) (string, error)
- func GetPersistentEnvValue(key string) (string, string, error)
- func GetPersistentEnvValues() (map[string]string, error)
- func GetShellExecutable() (string, error)
- func RunAndPipeInto(executable string, args []string, lines []string) error
- func RunPowershellScript(lines []string, loadProfile bool) error
- func SetPersistentEnvValue(key, value string) error
- func SetPersistentEnvValues(vars ...[2]string) error
- type PROCESSENTRY32
- type Paths
- type Shortcut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Arch ¶
func Arch() string
Arch retrieves the runtime architecture. This might differ from the compile time architecture. hence GOARCH can't be used here.
func CreateJunctions ¶ added in v0.0.4
CreateJunction will create multiple junctions. Each pair reflects one junction ([2]string{existing_dir, link_location}). A junction as a hardlink to a directory. This means, that we hardlink to the drive-sections, which results in deletions not affecting the actual data, as long as there are still references.
func CreateShortcuts ¶ added in v0.0.7
func ExtractDir ¶ added in v0.0.7
ExtractDir will move all files of a given to the target directory
func ForceRemoveAll ¶ added in v0.0.7
ForceRemoveAll will delete any file or folder recursively. This will not delete the content of junctions.
func GetDirFilenames ¶ added in v0.0.4
func GetFolderPath ¶ added in v0.0.7
GetFolderPath is equivalent to [Environment]::GetFolderPath and determines user-specific folder locations.
func GetPersistentEnvValue ¶ added in v0.0.4
GetPersistentEnvValue retrieves a persistent user level environment variable. The first returned value is the key and the second the value. While the key is defined in the query, the casing might be different, which COULD matter. If nothing was found, we return empty strings without an error.
func GetPersistentEnvValues ¶ added in v0.0.4
func GetShellExecutable ¶ added in v0.0.4
func RunAndPipeInto ¶ added in v0.0.7
func RunPowershellScript ¶ added in v0.0.7
RunPowershellScript will try running a powershell script using pwsh or powershell. This is dependent on the current shell. If the shell isn't supported, we fallback to powershell. This command blocks til all lines have been executed.
func SetPersistentEnvValue ¶ added in v0.0.4
Sets a User-Level Environment variable. An empty value will remove the key completly.
func SetPersistentEnvValues ¶ added in v0.0.4
Types ¶
type PROCESSENTRY32 ¶ added in v0.0.4
type PROCESSENTRY32 struct { Size uint32 ProcessID uint32 ParentProcessID uint32 // ExeFile is expected to be at max 260 chars, as windows by default doesn't // support long paths. While this could fail, we'll ignore this for now, as // it is unlikely to happen. ExeFile [260]uint16 // contains filtered or unexported fields }
PROCESSENTRY32 is a process as defined by Windows. We've simple padded everything with unused field, to be able to parse everything and indicate that the fields are unused at the same time.
type Paths ¶ added in v0.0.4
type Paths []string
func ParsePath ¶ added in v0.0.4
ParsePath will break the path variable content down into separate paths. This also handles quoting. The order is preserved.
func (Paths) Prepend ¶ added in v0.0.4
Preprend will create a new Paths object, adding the supplied paths infront, using the given order.
type Shortcut ¶ added in v0.0.7
type Shortcut struct { // Dir is the location to create the shortcut in Dir string // LinkTarget is the location of the executable to be run. LinkTarget string // Alias is the name displayed in the explorer / startmenu. Alias string // Args are optional commandline arguments. Args string // Icon is an optional image displayed in the explorer / startmenu. Icon string }