helpers

package module
v0.0.0-...-a6df557 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDevice

func CleanDevice(str string) string

func CleanDevices

func CleanDevices(s []string) []string

func CleanFile

func CleanFile(str string) string

func CleanFiles

func CleanFiles(s []string) []string

func CommandExists

func CommandExists(str string) (string, bool)

Returns full path of command and true if in PATH or working directory

func Contains

func Contains(s []string, str string) (int, bool)

func ContainsAny

func ContainsAny(s []string, s2 []string) (int, bool)

Checks if an array contains any of the elements from another array

func DirExists

func DirExists(path string) bool

func ExpandDir

func ExpandDir(str string) string

Expand xdg and shorthand directories into either real directories on the user's machine or some generic names to be used to protect the actual path names in case the user has changed them

func ExpandGenericDir

func ExpandGenericDir(str string) string

func ExtractResource

func ExtractResource(aiPath string, src string, dest string) error

func ExtractResourceReader

func ExtractResourceReader(aiPath string, src string) (io.ReadCloser, error)

func FileExists

func FileExists(path string) bool

Returns true if any kind of file (including dirs) exists at `path`

func GetAppImageType

func GetAppImageType(src string) (int, error)

Find the type of AppImage Returns strings either `1` for ISO disk image AppImage, `2` for type 2 SquashFS AppImage, `0` for unknown valid ELF or `-2` for shell script SquashFS AppImage (shappimage)

func GetOffset

func GetOffset(src string) (int, error)

GetOffset takes an AppImage (either ELF or shappimage), returning the offset of its SquashFS archive

func GetWorkDir

func GetWorkDir() (string, error)

Finds full path of running executable

func HasMagic

func HasMagic(r io.ReadSeeker, str string, offset int) bool

Checks the magic of a given file against the byte array provided if identical, return true

func MakeTemp

func MakeTemp(path string, name string) (string, error)

Takes a full path and prefix, creates a temporary directory and returns its path

func RandString

func RandString(seed int, length int) string

func ReadUpdateInfo

func ReadUpdateInfo(src string) (string, error)

func RealHome

func RealHome() (string, error)

Get the home directory using `/etc/passwd`, discarding the $HOME variable. This is used in aisap so that its config files can be stored in

func SplitKey

func SplitKey(str string) []string

Converts a multi-item INI value into a slice eg: `foo;bar;` becomes []string{ "foo", "bar" }

Types

This section is empty.

Jump to

Keyboard shortcuts

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